29static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
30 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
31 unsigned valueIndex) {
33 return op->emitOpError(valueKind) <<
" #" << valueIndex
34 <<
" must be variadic of a valid LLZK type, but got " << type;
36 return ::mlir::success();
39static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
40 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
41 unsigned valueIndex) {
42 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
43 return op->emitOpError(valueKind) <<
" #" << valueIndex
44 <<
" must be variadic of index, but got " << type;
46 return ::mlir::success();
49static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
50 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
51 unsigned valueIndex) {
52 if (!((::llvm::isa<::llzk::pod::PodType>(type)))) {
53 return op->emitOpError(valueKind) <<
" #" << valueIndex
54 <<
" must be plain-old-data struct, but got " << type;
56 return ::mlir::success();
59static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops4(
60 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
61 unsigned valueIndex) {
63 return op->emitOpError(valueKind) <<
" #" << valueIndex
64 <<
" must be a valid LLZK type, but got " << type;
66 return ::mlir::success();
69static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
70 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
71 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) {
return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
72 return emitError() <<
"attribute '" << attrName
73 <<
"' failed to satisfy constraint: string array attribute";
74 return ::mlir::success();
76static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
77 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
78 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
79 return op->emitOpError();
83static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
84 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
85 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
86 return emitError() <<
"attribute '" << attrName
87 <<
"' failed to satisfy constraint: i32 dense array attribute";
88 return ::mlir::success();
90static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
91 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
92 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
93 return op->emitOpError();
97static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
98 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
99 if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
100 return emitError() <<
"attribute '" << attrName
101 <<
"' failed to satisfy constraint: flat symbol reference attribute";
102 return ::mlir::success();
104static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
105 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
106 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
107 return op->emitOpError();
126 for (
unsigned i = 0; i < index; ++i)
127 start += sizeAttr[i];
128 return {start, sizeAttr[index]};
132 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(
getProperties().initializedRecords);
142 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
162 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'pod.new' op ""requires attribute 'mapOpGroupSizes'");
165 if (tblgen_initializedRecords && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_initializedRecords))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_initializedRecords), [&](::mlir::Attribute attr) {
return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
166 return emitError(loc,
"'pod.new' op ""attribute 'initializedRecords' failed to satisfy constraint: string array attribute");
168 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
169 return emitError(loc,
"'pod.new' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
171 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
172 return emitError(loc,
"'pod.new' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
173 return ::mlir::success();
177 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
180 for (
unsigned i = 0; i < index; ++i)
181 start += sizeAttr[i];
182 return {start, sizeAttr[index]};
187 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
193 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
198 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
200 emitError() <<
"expected DictionaryAttr to set properties";
201 return ::mlir::failure();
206 auto attr = dict.get(
"initializedRecords");
208 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
210 propStorage = convertedAttr;
212 emitError() <<
"Invalid attribute `initializedRecords` in property conversion: " << attr;
213 return ::mlir::failure();
220 auto attr = dict.get(
"mapOpGroupSizes");
222 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
224 propStorage = convertedAttr;
226 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
227 return ::mlir::failure();
234 auto attr = dict.get(
"numDimsPerMap");
236 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
238 propStorage = convertedAttr;
240 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
241 return ::mlir::failure();
247 auto setFromAttr = [] (
auto &propStorage, ::mlir::Attribute propAttr,
248 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
249 return convertFromAttribute(propStorage, propAttr, emitError);
251 auto attr = dict.get(
"operandSegmentSizes");
if (!attr) attr = dict.get(
"operand_segment_sizes");;
254 return ::mlir::failure();
256 return ::mlir::success();
260 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
261 ::mlir::Builder odsBuilder{ctx};
266 attrs.push_back(odsBuilder.getNamedAttr(
"initializedRecords",
273 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
280 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
286 auto attr = [&]() -> ::mlir::Attribute {
287 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
289 attrs.push_back(odsBuilder.getNamedAttr(
"operandSegmentSizes", attr));
293 return odsBuilder.getDictionaryAttr(attrs);
298 auto hash_operandSegmentSizes = [] (
const auto &propStorage) -> llvm::hash_code {
299 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
301 return llvm::hash_combine(
309 if (name ==
"initializedRecords")
312 if (name ==
"mapOpGroupSizes")
315 if (name ==
"numDimsPerMap")
317 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes")
return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }();
322 if (name ==
"initializedRecords") {
327 if (name ==
"mapOpGroupSizes") {
332 if (name ==
"numDimsPerMap") {
336 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes") {
337 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
338 if (!arrAttr)
return;
352 attrs.append(
"operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }());
355::llvm::LogicalResult
NewPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
358 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"initializedRecords", emitError)))
359 return ::mlir::failure();
364 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"mapOpGroupSizes", emitError)))
365 return ::mlir::failure();
370 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"numDimsPerMap", emitError)))
371 return ::mlir::failure();
373 return ::mlir::success();
377 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
379 return ::mlir::failure();
382 return ::mlir::failure();
384 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
385 return ::mlir::failure();
387 if (reader.getBytecodeVersion() < 6) {
389 ::mlir::DenseI32ArrayAttr attr;
390 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
391 if (attr.size() >
static_cast<int64_t
>(
sizeof(propStorage) /
sizeof(int32_t))) {
392 reader.emitError(
"size mismatch for operand/result_segment_size");
393 return ::mlir::failure();
395 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
400 auto readProp = [&]() {
402 if (reader.getBytecodeVersion() >= 6)
403 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
405 return ::mlir::success();
407 if (::mlir::failed(readProp()))
408 return ::mlir::failure();
410 return ::mlir::success();
414 auto &prop = getProperties(); (void)prop;
421if (writer.getBytecodeVersion() < 6) {
423 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
429 if (writer.getBytecodeVersion() >= 6)
430 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
451 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
455 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
460 build(odsBuilder, odsState, resultType, initialValues);
465 build(odsBuilder, odsState, resultType, mapOperands,
466 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap), initialValues);
471 ::mlir::Builder odsBuilder(opName.getContext());
475 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
479 auto tblgen_initializedRecords = getProperties().initializedRecords; (void)tblgen_initializedRecords;
480 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
481 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
482 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
484 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_initializedRecords,
"initializedRecords")))
485 return ::mlir::failure();
487 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
488 return ::mlir::failure();
490 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
491 return ::mlir::failure();
493 unsigned index = 0; (void)index;
496 for (
auto v : valueGroup0) {
497 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
498 return ::mlir::failure();
501 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
502 return ::mlir::failure();
504 for (
auto v : valueGroup1) {
505 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
506 return ::mlir::failure();
510 unsigned index = 0; (void)index;
513 for (
auto v : valueGroup0) {
514 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"result", index++)))
515 return ::mlir::failure();
518 return ::mlir::success();
523 return ::mlir::success();
524 return ::mlir::failure();
527void NewPodOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
546 return attr.getValue();
554 if (!tblgen_record_name)
return emitError(loc,
"'pod.read' op ""requires attribute 'record_name'");
556 if (tblgen_record_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_record_name))))
557 return emitError(loc,
"'pod.read' op ""attribute 'record_name' failed to satisfy constraint: flat symbol reference attribute");
558 return ::mlir::success();
562 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
564 emitError() <<
"expected DictionaryAttr to set properties";
565 return ::mlir::failure();
570 auto attr = dict.get(
"record_name");
572 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
574 propStorage = convertedAttr;
576 emitError() <<
"Invalid attribute `record_name` in property conversion: " << attr;
577 return ::mlir::failure();
581 return ::mlir::success();
585 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
586 ::mlir::Builder odsBuilder{ctx};
591 attrs.push_back(odsBuilder.getNamedAttr(
"record_name",
596 return odsBuilder.getDictionaryAttr(attrs);
601 return llvm::hash_combine(
602 llvm::hash_value(prop.
record_name.getAsOpaquePointer()));
606 if (name ==
"record_name")
612 if (name ==
"record_name") {
622::llvm::LogicalResult
ReadPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
625 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"record_name", emitError)))
626 return ::mlir::failure();
628 return ::mlir::success();
632 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
633 if (::mlir::failed(reader.readAttribute(prop.
record_name)))
634 return ::mlir::failure();
635 return ::mlir::success();
639 auto &prop = getProperties(); (void)prop;
645 return attr.getValue();
649 getProperties().record_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
652void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name) {
653 odsState.addOperands(pod_ref);
654 odsState.getOrAddProperties<
Properties>().record_name = record_name;
655 odsState.addTypes(result);
658void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name) {
659 odsState.addOperands(pod_ref);
660 odsState.getOrAddProperties<
Properties>().record_name = record_name;
661 assert(resultTypes.size() == 1u &&
"mismatched number of results");
662 odsState.addTypes(resultTypes);
665void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
666 odsState.addOperands(pod_ref);
667 odsState.getOrAddProperties<
Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
668 odsState.addTypes(result);
671void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
672 odsState.addOperands(pod_ref);
673 odsState.getOrAddProperties<
Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
674 assert(resultTypes.size() == 1u &&
"mismatched number of results");
675 odsState.addTypes(resultTypes);
678void ReadPodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
679 assert(operands.size() == 1u &&
"mismatched number of parameters");
680 odsState.addOperands(operands);
681 odsState.addAttributes(attributes);
682 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
683 odsState.addTypes(resultTypes);
685 if (!attributes.empty()) {
686 ::mlir::OpaqueProperties properties =
688 std::optional<::mlir::RegisteredOperationName> info =
689 odsState.name.getRegisteredInfo();
690 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
691 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
692 ::llvm::report_fatal_error(
"Property conversion failed.");
697 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
698 if (!tblgen_record_name)
return emitOpError(
"requires attribute 'record_name'");
700 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_record_name,
"record_name")))
701 return ::mlir::failure();
703 unsigned index = 0; (void)index;
706 for (
auto v : valueGroup0) {
707 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
708 return ::mlir::failure();
712 unsigned index = 0; (void)index;
715 for (
auto v : valueGroup0) {
716 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"result", index++)))
717 return ::mlir::failure();
720 return ::mlir::success();
725 return ::mlir::success();
726 return ::mlir::failure();
729::mlir::ParseResult
ReadPodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
730 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
731 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
732 (void)pod_refOperandsLoc;
733 ::mlir::FlatSymbolRefAttr record_nameAttr;
734 ::mlir::Type pod_refRawType{};
735 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
736 ::mlir::Type resultRawType{};
737 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
739 pod_refOperandsLoc = parser.getCurrentLocation();
740 if (parser.parseOperand(pod_refRawOperand))
741 return ::mlir::failure();
742 if (parser.parseLSquare())
743 return ::mlir::failure();
746 if (odsResult) return ::mlir::failure();
749 if (parser.parseRSquare())
750 return ::mlir::failure();
751 if (parser.parseColon())
752 return ::mlir::failure();
756 if (parser.parseCustomTypeWithFallback(type))
757 return ::mlir::failure();
758 pod_refRawType = type;
760 if (parser.parseComma())
761 return ::mlir::failure();
765 if (parser.parseCustomTypeWithFallback(type))
766 return ::mlir::failure();
767 resultRawType = type;
770 auto loc = parser.getCurrentLocation();(void)loc;
771 if (parser.parseOptionalAttrDict(result.attributes))
772 return ::mlir::failure();
774 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
776 return ::mlir::failure();
778 result.addTypes(resultTypes);
779 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
780 return ::mlir::failure();
781 return ::mlir::success();
790 _odsPrinter <<
' ' <<
":";
794 if (
auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
795 _odsPrinter.printStrippedAttrOrType(validType);
803 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
804 _odsPrinter.printStrippedAttrOrType(validType);
808 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
809 elidedAttrs.push_back(
"record_name");
810 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
829 return attr.getValue();
837 if (!tblgen_record_name)
return emitError(loc,
"'pod.write' op ""requires attribute 'record_name'");
839 if (tblgen_record_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_record_name))))
840 return emitError(loc,
"'pod.write' op ""attribute 'record_name' failed to satisfy constraint: flat symbol reference attribute");
841 return ::mlir::success();
845 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
847 emitError() <<
"expected DictionaryAttr to set properties";
848 return ::mlir::failure();
853 auto attr = dict.get(
"record_name");
855 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
857 propStorage = convertedAttr;
859 emitError() <<
"Invalid attribute `record_name` in property conversion: " << attr;
860 return ::mlir::failure();
864 return ::mlir::success();
868 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
869 ::mlir::Builder odsBuilder{ctx};
874 attrs.push_back(odsBuilder.getNamedAttr(
"record_name",
879 return odsBuilder.getDictionaryAttr(attrs);
884 return llvm::hash_combine(
885 llvm::hash_value(prop.
record_name.getAsOpaquePointer()));
889 if (name ==
"record_name")
895 if (name ==
"record_name") {
905::llvm::LogicalResult
WritePodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
908 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"record_name", emitError)))
909 return ::mlir::failure();
911 return ::mlir::success();
915 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
916 if (::mlir::failed(reader.readAttribute(prop.
record_name)))
917 return ::mlir::failure();
918 return ::mlir::success();
922 auto &prop = getProperties(); (void)prop;
928 return attr.getValue();
932 getProperties().record_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
935void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value) {
936 odsState.addOperands(pod_ref);
937 odsState.addOperands(value);
938 odsState.getOrAddProperties<
Properties>().record_name = record_name;
941void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value) {
942 odsState.addOperands(pod_ref);
943 odsState.addOperands(value);
944 odsState.getOrAddProperties<
Properties>().record_name = record_name;
945 assert(resultTypes.size() == 0u &&
"mismatched number of results");
946 odsState.addTypes(resultTypes);
949void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
950 odsState.addOperands(pod_ref);
951 odsState.addOperands(value);
952 odsState.getOrAddProperties<
Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
955void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
956 odsState.addOperands(pod_ref);
957 odsState.addOperands(value);
958 odsState.getOrAddProperties<
Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
959 assert(resultTypes.size() == 0u &&
"mismatched number of results");
960 odsState.addTypes(resultTypes);
963void WritePodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
964 assert(operands.size() == 2u &&
"mismatched number of parameters");
965 odsState.addOperands(operands);
966 odsState.addAttributes(attributes);
967 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
968 odsState.addTypes(resultTypes);
970 if (!attributes.empty()) {
971 ::mlir::OpaqueProperties properties =
973 std::optional<::mlir::RegisteredOperationName> info =
974 odsState.name.getRegisteredInfo();
975 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
976 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
977 ::llvm::report_fatal_error(
"Property conversion failed.");
982 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
983 if (!tblgen_record_name)
return emitOpError(
"requires attribute 'record_name'");
985 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_record_name,
"record_name")))
986 return ::mlir::failure();
988 unsigned index = 0; (void)index;
991 for (
auto v : valueGroup0) {
992 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
993 return ::mlir::failure();
997 for (
auto v : valueGroup1) {
998 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
999 return ::mlir::failure();
1002 return ::mlir::success();
1007 return ::mlir::success();
1008 return ::mlir::failure();
1012 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
1013 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
1014 (void)pod_refOperandsLoc;
1015 ::mlir::FlatSymbolRefAttr record_nameAttr;
1016 ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
1017 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
1018 (void)valueOperandsLoc;
1019 ::mlir::Type pod_refRawType{};
1020 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
1021 ::mlir::Type valueRawType{};
1022 ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
1024 pod_refOperandsLoc = parser.getCurrentLocation();
1025 if (parser.parseOperand(pod_refRawOperand))
1026 return ::mlir::failure();
1027 if (parser.parseLSquare())
1028 return ::mlir::failure();
1031 if (odsResult) return ::mlir::failure();
1034 if (parser.parseRSquare())
1035 return ::mlir::failure();
1036 if (parser.parseEqual())
1037 return ::mlir::failure();
1039 valueOperandsLoc = parser.getCurrentLocation();
1040 if (parser.parseOperand(valueRawOperand))
1041 return ::mlir::failure();
1042 if (parser.parseColon())
1043 return ::mlir::failure();
1047 if (parser.parseCustomTypeWithFallback(type))
1048 return ::mlir::failure();
1049 pod_refRawType = type;
1051 if (parser.parseComma())
1052 return ::mlir::failure();
1056 if (parser.parseCustomTypeWithFallback(type))
1057 return ::mlir::failure();
1058 valueRawType = type;
1061 auto loc = parser.getCurrentLocation();(void)loc;
1062 if (parser.parseOptionalAttrDict(result.attributes))
1063 return ::mlir::failure();
1065 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1067 return ::mlir::failure();
1069 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
1070 return ::mlir::failure();
1071 if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
1072 return ::mlir::failure();
1073 return ::mlir::success();
1082 _odsPrinter <<
' ' <<
"=";
1085 _odsPrinter <<
' ' <<
":";
1089 if (
auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
1090 _odsPrinter.printStrippedAttrOrType(validType);
1092 _odsPrinter << type;
1098 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1099 _odsPrinter.printStrippedAttrOrType(validType);
1101 _odsPrinter << type;
1103 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1104 elidedAttrs.push_back(
"record_name");
1105 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
::llvm::LogicalResult verify(::mlir::Location loc)
NewPodOpAdaptor(NewPodOp op)
NewPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static llvm::hash_code computePropertiesHash(const Properties &prop)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::ArrayAttr getInitializedRecordsAttr()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInvariantsImpl()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::pod::InitializedRecords initialValues={})
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::StringAttr getInitializedRecordsAttrName()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::StringAttr getMapOpGroupSizesAttrName()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::mlir::MutableOperandRange getInitialValuesMutable()
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
FoldAdaptor::Properties Properties
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::MutableOperandRangeRange getMapOperandsMutable()
::llvm::LogicalResult verify()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::mlir::ArrayAttr getInitializedRecords()
::mlir::StringAttr getNumDimsPerMapAttrName()
static PodType fromInitialValues(::mlir::MLIRContext *ctx, InitializedRecords init)
Creates a new type from a set of initialized records.
ReadPodOpAdaptor(ReadPodOp op)
ReadPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInvariants()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::StringRef getRecordName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::TypedValue<::mlir::Type > getResult()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::FlatSymbolRefAttr getRecordNameAttr()
::llvm::LogicalResult verifyInvariantsImpl()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verify()
FoldAdaptor::Properties Properties
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
void print(::mlir::OpAsmPrinter &_odsPrinter)
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name)
::mlir::StringAttr getRecordNameAttrName()
void setRecordName(::llvm::StringRef attrValue)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
WritePodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
WritePodOpAdaptor(WritePodOp op)
::mlir::ValueRange getOperands()
::mlir::FlatSymbolRefAttr getRecordNameAttr()
::llvm::LogicalResult verify()
static llvm::hash_code computePropertiesHash(const Properties &prop)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInvariants()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getValue()
void setRecordName(::llvm::StringRef attrValue)
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
FoldAdaptor::Properties Properties
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Operation::operand_range getODSOperands(unsigned index)
::llvm::LogicalResult verifyInvariantsImpl()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::StringRef getRecordName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::StringAttr getRecordNameAttrName()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::ArrayAttr getInitializedRecords()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
NewPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::mlir::RegionRange odsRegions
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::std::optional<::mlir::OperationName > odsOpName
::mlir::ArrayAttr getInitializedRecordsAttr()
const Properties & getProperties()
::mlir::DictionaryAttr odsAttrs
::llvm::StringRef getRecordName()
::mlir::FlatSymbolRefAttr getRecordNameAttr()
const Properties & getProperties()
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
ReadPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::FlatSymbolRefAttr getRecordNameAttr()
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
const Properties & getProperties()
WritePodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
::llvm::StringRef getRecordName()
mlir::ArrayRef< RecordValue > InitializedRecords
ParseResult parseRecordName(AsmParser &parser, FlatSymbolRefAttr &name)
void printRecordName(AsmPrinter &printer, Operation *, FlatSymbolRefAttr name)
bool isValidType(Type type)
mapOpGroupSizesTy mapOpGroupSizes
operandSegmentSizesTy operandSegmentSizes
initializedRecordsTy initializedRecords
numDimsPerMapTy numDimsPerMap
record_nameTy record_name
record_nameTy record_name