/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|*                                                                            *|
|* Op Definitions                                                             *|
|*                                                                            *|
|* Automatically generated file, do not edit!                                 *|
|* From: GPUTransformOps.td                                                   *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#ifdef GET_OP_LIST
#undef GET_OP_LIST

::mlir::transform::ApplyGPUPromoteShuffleToAMDGPUPatternsOp,
::mlir::transform::ApplyGPURewritePatternsOp,
::mlir::transform::ApplyGPUSubgroupReduceToNVVMConversionPatternsOp,
::mlir::transform::ApplyGPUToNVVMConversionPatternsOp,
::mlir::transform::ApplyGPUToROCDLConversionPatternsOp,
::mlir::transform::ApplyGPUWwmaToNVVMConversionPatternsOp,
::mlir::transform::ApplyUnrollVectorsSubgroupMmaOp,
::mlir::transform::EliminateBarriersOp,
::mlir::transform::MapForallToBlocks,
::mlir::transform::MapNestedForallToThreads
#endif // GET_OP_LIST

#ifdef GET_OP_CLASSES
#undef GET_OP_CLASSES


//===----------------------------------------------------------------------===//
// Local Utility Method Definitions
//===----------------------------------------------------------------------===//


static ::llvm::LogicalResult __mlir_ods_local_type_constraint_GPUTransformOps1(
    ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
    unsigned valueIndex) {
  if (!((::llvm::isa<::mlir::transform::TransformHandleTypeInterface>(type)))) {
    return op->emitOpError(valueKind) << " #" << valueIndex
        << " must be TransformHandleTypeInterface instance, but got " << type;
  }
  return ::mlir::success();
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps1(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: string attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps1(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps1(attr, attrName, [op]() {
    return op->emitOpError();
  });
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps2(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(16)))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: 16-bit signless integer attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps2(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps2(attr, attrName, [op]() {
    return op->emitOpError();
  });
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps3(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: 64-bit signless integer attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps3(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps3(attr, attrName, [op]() {
    return op->emitOpError();
  });
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps4(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: i64 dense array attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps4(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps4(attr, attrName, [op]() {
    return op->emitOpError();
  });
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps5(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: unit attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps5(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps5(attr, attrName, [op]() {
    return op->emitOpError();
  });
}

static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps6(
    ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr))))
    return emitError() << "attribute '" << attrName
        << "' failed to satisfy constraint: bool attribute";
  return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_GPUTransformOps6(
    ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
  return __mlir_ods_local_attr_constraint_GPUTransformOps6(attr, attrName, [op]() {
    return op->emitOpError();
  });
}
namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPUPromoteShuffleToAMDGPUPatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPUPromoteShuffleToAMDGPUPatternsOpGenericAdaptorBase::ApplyGPUPromoteShuffleToAMDGPUPatternsOpGenericAdaptorBase(ApplyGPUPromoteShuffleToAMDGPUPatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

::std::optional< ::llvm::StringRef > ApplyGPUPromoteShuffleToAMDGPUPatternsOpGenericAdaptorBase::getChipset() {
  auto attr = getChipsetAttr();
  return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
}


} // namespace detail
ApplyGPUPromoteShuffleToAMDGPUPatternsOpAdaptor::ApplyGPUPromoteShuffleToAMDGPUPatternsOpAdaptor(ApplyGPUPromoteShuffleToAMDGPUPatternsOp op) : ApplyGPUPromoteShuffleToAMDGPUPatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOpAdaptor::verify(::mlir::Location loc) {
  auto tblgen_chipset = getProperties().chipset; (void)tblgen_chipset;

  if (tblgen_chipset && !((::llvm::isa<::mlir::StringAttr>(tblgen_chipset))))
    return emitError(loc, "'transform.apply_patterns.gpu.gpu_shuffle_to_amdgpu' op attribute 'chipset' failed to satisfy constraint: string attribute");
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.chipset;
       auto attr = dict.get("chipset");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `chipset` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute ApplyGPUPromoteShuffleToAMDGPUPatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.chipset;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("chipset",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPUPromoteShuffleToAMDGPUPatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.chipset.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> ApplyGPUPromoteShuffleToAMDGPUPatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "chipset")
      return prop.chipset;
  return std::nullopt;
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "chipset") {
       prop.chipset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.chipset)>>(value);
       return;
    }
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.chipset) attrs.append("chipset", prop.chipset);
}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getChipsetAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps1(attr, "chipset", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readOptionalAttribute(prop.chipset)))
    return ::mlir::failure();
  return ::mlir::success();
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;

  writer.writeOptionalAttribute(prop.chipset);
}

::std::optional< ::llvm::StringRef > ApplyGPUPromoteShuffleToAMDGPUPatternsOp::getChipset() {
  auto attr = getChipsetAttr();
  return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::setChipset(::std::optional<::llvm::StringRef> attrValue) {
    auto &odsProp = getProperties().chipset;
    if (attrValue)
      odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
    else
      odsProp = nullptr;
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::StringAttr chipset) {
  if (chipset) {
    odsState.getOrAddProperties<Properties>().chipset = chipset;
  }
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::StringAttr chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUPromoteShuffleToAMDGPUPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::StringAttr chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr chipset) {
  if (chipset) {
    odsState.getOrAddProperties<Properties>().chipset = chipset;
  }
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUPromoteShuffleToAMDGPUPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<ApplyGPUPromoteShuffleToAMDGPUPatternsOp::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUPromoteShuffleToAMDGPUPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUPromoteShuffleToAMDGPUPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUPromoteShuffleToAMDGPUPatternsOp ApplyGPUPromoteShuffleToAMDGPUPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::verifyInvariantsImpl() {
  auto tblgen_chipset = getProperties().chipset; (void)tblgen_chipset;

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps1(*this, tblgen_chipset, "chipset")))
    return ::mlir::failure();
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPUPromoteShuffleToAMDGPUPatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  ::mlir::StringAttr chipsetAttr;
  if (::mlir::succeeded(parser.parseOptionalKeyword("chipset"))) {
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(chipsetAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
    return ::mlir::failure();
  }
  if (chipsetAttr) result.getOrAddProperties<ApplyGPUPromoteShuffleToAMDGPUPatternsOp::Properties>().chipset = chipsetAttr;
  }
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPUPromoteShuffleToAMDGPUPatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  if (getChipsetAttr()) {
    _odsPrinter << ' ' << "chipset";
    _odsPrinter << ' ' << "=";
    _odsPrinter << ' ';
    _odsPrinter.printAttributeWithoutType(getChipsetAttr());
  }
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  elidedAttrs.push_back("chipset");
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPUPromoteShuffleToAMDGPUPatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPURewritePatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPURewritePatternsOpGenericAdaptorBase::ApplyGPURewritePatternsOpGenericAdaptorBase(ApplyGPURewritePatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}


} // namespace detail
ApplyGPURewritePatternsOpAdaptor::ApplyGPURewritePatternsOpAdaptor(ApplyGPURewritePatternsOp op) : ApplyGPURewritePatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPURewritePatternsOpAdaptor::verify(::mlir::Location loc) {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPURewritePatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }
      return ::mlir::success();
}

::mlir::Attribute ApplyGPURewritePatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPURewritePatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine();
}

std::optional<mlir::Attribute> ApplyGPURewritePatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
  return std::nullopt;
}

void ApplyGPURewritePatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}

void ApplyGPURewritePatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}

::llvm::LogicalResult ApplyGPURewritePatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    return ::mlir::success();
}

void ApplyGPURewritePatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__);
  auto __res__ = ::llvm::dyn_cast<ApplyGPURewritePatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::ImplicitLocOpBuilder &builder) {
  return create(builder, builder.getLoc());
}

void ApplyGPURewritePatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPURewritePatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}

void ApplyGPURewritePatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPURewritePatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPURewritePatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPURewritePatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPURewritePatternsOp ApplyGPURewritePatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyGPURewritePatternsOp::verifyInvariantsImpl() {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPURewritePatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPURewritePatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPURewritePatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPURewritePatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPUSubgroupReduceToNVVMConversionPatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPUSubgroupReduceToNVVMConversionPatternsOpGenericAdaptorBase::ApplyGPUSubgroupReduceToNVVMConversionPatternsOpGenericAdaptorBase(ApplyGPUSubgroupReduceToNVVMConversionPatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}


} // namespace detail
ApplyGPUSubgroupReduceToNVVMConversionPatternsOpAdaptor::ApplyGPUSubgroupReduceToNVVMConversionPatternsOpAdaptor(ApplyGPUSubgroupReduceToNVVMConversionPatternsOp op) : ApplyGPUSubgroupReduceToNVVMConversionPatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOpAdaptor::verify(::mlir::Location loc) {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }
      return ::mlir::success();
}

::mlir::Attribute ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine();
}

std::optional<mlir::Attribute> ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
  return std::nullopt;
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}

::llvm::LogicalResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    return ::mlir::success();
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__);
  auto __res__ = ::llvm::dyn_cast<ApplyGPUSubgroupReduceToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder) {
  return create(builder, builder.getLoc());
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUSubgroupReduceToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUSubgroupReduceToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUSubgroupReduceToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUSubgroupReduceToNVVMConversionPatternsOp ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::verifyInvariantsImpl() {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPUSubgroupReduceToNVVMConversionPatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPUSubgroupReduceToNVVMConversionPatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPUToNVVMConversionPatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPUToNVVMConversionPatternsOpGenericAdaptorBase::ApplyGPUToNVVMConversionPatternsOpGenericAdaptorBase(ApplyGPUToNVVMConversionPatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

::mlir::IntegerAttr ApplyGPUToNVVMConversionPatternsOpGenericAdaptorBase::getBenefitAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().benefit);
  return attr;
}

uint16_t ApplyGPUToNVVMConversionPatternsOpGenericAdaptorBase::getBenefit() {
  auto attr = getBenefitAttr();
  return attr.getValue().getZExtValue();
}


} // namespace detail
ApplyGPUToNVVMConversionPatternsOpAdaptor::ApplyGPUToNVVMConversionPatternsOpAdaptor(ApplyGPUToNVVMConversionPatternsOp op) : ApplyGPUToNVVMConversionPatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOpAdaptor::verify(::mlir::Location loc) {
  auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit;

  if (tblgen_benefit && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_benefit))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_benefit).getType().isSignlessInteger(16)))))
    return emitError(loc, "'transform.apply_conversion_patterns.gpu.gpu_to_nvvm' op attribute 'benefit' failed to satisfy constraint: 16-bit signless integer attribute");
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.benefit;
       auto attr = dict.get("benefit");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `benefit` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute ApplyGPUToNVVMConversionPatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.benefit;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("benefit",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPUToNVVMConversionPatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.benefit.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> ApplyGPUToNVVMConversionPatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "benefit")
      return prop.benefit;
  return std::nullopt;
}

void ApplyGPUToNVVMConversionPatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "benefit") {
       prop.benefit = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.benefit)>>(value);
       return;
    }
}

void ApplyGPUToNVVMConversionPatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.benefit) attrs.append("benefit", prop.benefit);
}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getBenefitAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps2(attr, "benefit", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readOptionalAttribute(prop.benefit)))
    return ::mlir::failure();
  return ::mlir::success();
}

void ApplyGPUToNVVMConversionPatternsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;

  writer.writeOptionalAttribute(prop.benefit);
}

uint16_t ApplyGPUToNVVMConversionPatternsOp::getBenefit() {
  auto attr = getBenefitAttr();
  return attr.getValue().getZExtValue();
}

void ApplyGPUToNVVMConversionPatternsOp::setBenefit(uint16_t attrValue) {
  getProperties().benefit = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(16), attrValue);
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr benefit) {
  if (benefit) {
    odsState.getOrAddProperties<Properties>().benefit = benefit;
  }
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr benefit) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(benefit)>(benefit));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr benefit) {
  return create(builder, builder.getLoc(), std::forward<decltype(benefit)>(benefit));
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr benefit) {
  if (benefit) {
    odsState.getOrAddProperties<Properties>().benefit = benefit;
  }
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr benefit) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(benefit)>(benefit));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr benefit) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(benefit)>(benefit));
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint16_t benefit) {
  odsState.getOrAddProperties<Properties>().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit);
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint16_t benefit) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(benefit)>(benefit));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, uint16_t benefit) {
  return create(builder, builder.getLoc(), std::forward<decltype(benefit)>(benefit));
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint16_t benefit) {
  odsState.getOrAddProperties<Properties>().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit);
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint16_t benefit) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(benefit)>(benefit));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint16_t benefit) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(benefit)>(benefit));
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<ApplyGPUToNVVMConversionPatternsOp::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPUToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToNVVMConversionPatternsOp ApplyGPUToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

void ApplyGPUToNVVMConversionPatternsOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
  ::mlir::Builder odsBuilder(opName.getContext());
  if (!properties.benefit)
    properties.benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), 1);
}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOp::verifyInvariantsImpl() {
  auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit;

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps2(*this, tblgen_benefit, "benefit")))
    return ::mlir::failure();
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToNVVMConversionPatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPUToNVVMConversionPatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPUToNVVMConversionPatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getBenefitAttr();
     if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), 1)))
       elidedAttrs.push_back("benefit");
  }
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPUToNVVMConversionPatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPUToROCDLConversionPatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPUToROCDLConversionPatternsOpGenericAdaptorBase::ApplyGPUToROCDLConversionPatternsOpGenericAdaptorBase(ApplyGPUToROCDLConversionPatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

::llvm::StringRef ApplyGPUToROCDLConversionPatternsOpGenericAdaptorBase::getChipset() {
  auto attr = getChipsetAttr();
  return attr.getValue();
}


} // namespace detail
ApplyGPUToROCDLConversionPatternsOpAdaptor::ApplyGPUToROCDLConversionPatternsOpAdaptor(ApplyGPUToROCDLConversionPatternsOp op) : ApplyGPUToROCDLConversionPatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOpAdaptor::verify(::mlir::Location loc) {
  auto tblgen_chipset = getProperties().chipset; (void)tblgen_chipset;
  if (!tblgen_chipset) return emitError(loc, "'transform.apply_conversion_patterns.gpu.gpu_to_rocdl' op requires attribute 'chipset'");

  if (tblgen_chipset && !((::llvm::isa<::mlir::StringAttr>(tblgen_chipset))))
    return emitError(loc, "'transform.apply_conversion_patterns.gpu.gpu_to_rocdl' op attribute 'chipset' failed to satisfy constraint: string attribute");
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.chipset;
       auto attr = dict.get("chipset");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `chipset` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute ApplyGPUToROCDLConversionPatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.chipset;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("chipset",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPUToROCDLConversionPatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.chipset.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> ApplyGPUToROCDLConversionPatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "chipset")
      return prop.chipset;
  return std::nullopt;
}

void ApplyGPUToROCDLConversionPatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "chipset") {
       prop.chipset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.chipset)>>(value);
       return;
    }
}

void ApplyGPUToROCDLConversionPatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.chipset) attrs.append("chipset", prop.chipset);
}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getChipsetAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps1(attr, "chipset", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readAttribute(prop.chipset)))
    return ::mlir::failure();
  return ::mlir::success();
}

void ApplyGPUToROCDLConversionPatternsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;
  writer.writeAttribute(prop.chipset);
}

::llvm::StringRef ApplyGPUToROCDLConversionPatternsOp::getChipset() {
  auto attr = getChipsetAttr();
  return attr.getValue();
}

void ApplyGPUToROCDLConversionPatternsOp::setChipset(::llvm::StringRef attrValue) {
  getProperties().chipset = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr chipset) {
  odsState.getOrAddProperties<Properties>().chipset = chipset;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr chipset) {
  odsState.getOrAddProperties<Properties>().chipset = chipset;
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef chipset) {
  odsState.getOrAddProperties<Properties>().chipset = odsBuilder.getStringAttr(chipset);
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef chipset) {
  odsState.getOrAddProperties<Properties>().chipset = odsBuilder.getStringAttr(chipset);
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef chipset) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef chipset) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(chipset)>(chipset));
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<ApplyGPUToROCDLConversionPatternsOp::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPUToROCDLConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUToROCDLConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUToROCDLConversionPatternsOp ApplyGPUToROCDLConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOp::verifyInvariantsImpl() {
  auto tblgen_chipset = getProperties().chipset; (void)tblgen_chipset;
  if (!tblgen_chipset) return emitOpError("requires attribute 'chipset'");

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps1(*this, tblgen_chipset, "chipset")))
    return ::mlir::failure();
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUToROCDLConversionPatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPUToROCDLConversionPatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  ::mlir::StringAttr chipsetAttr;
  if (parser.parseKeyword("chipset"))
    return ::mlir::failure();
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(chipsetAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
    return ::mlir::failure();
  }
  if (chipsetAttr) result.getOrAddProperties<ApplyGPUToROCDLConversionPatternsOp::Properties>().chipset = chipsetAttr;
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPUToROCDLConversionPatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  _odsPrinter << ' ' << "chipset";
  _odsPrinter << ' ' << "=";
  _odsPrinter << ' ';
  _odsPrinter.printAttributeWithoutType(getChipsetAttr());
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  elidedAttrs.push_back("chipset");
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPUToROCDLConversionPatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyGPUWwmaToNVVMConversionPatternsOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyGPUWwmaToNVVMConversionPatternsOpGenericAdaptorBase::ApplyGPUWwmaToNVVMConversionPatternsOpGenericAdaptorBase(ApplyGPUWwmaToNVVMConversionPatternsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}


} // namespace detail
ApplyGPUWwmaToNVVMConversionPatternsOpAdaptor::ApplyGPUWwmaToNVVMConversionPatternsOpAdaptor(ApplyGPUWwmaToNVVMConversionPatternsOp op) : ApplyGPUWwmaToNVVMConversionPatternsOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyGPUWwmaToNVVMConversionPatternsOpAdaptor::verify(::mlir::Location loc) {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUWwmaToNVVMConversionPatternsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }
      return ::mlir::success();
}

::mlir::Attribute ApplyGPUWwmaToNVVMConversionPatternsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyGPUWwmaToNVVMConversionPatternsOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine();
}

std::optional<mlir::Attribute> ApplyGPUWwmaToNVVMConversionPatternsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
  return std::nullopt;
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}

::llvm::LogicalResult ApplyGPUWwmaToNVVMConversionPatternsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    return ::mlir::success();
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__);
  auto __res__ = ::llvm::dyn_cast<ApplyGPUWwmaToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder) {
  return create(builder, builder.getLoc());
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUWwmaToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUWwmaToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyGPUWwmaToNVVMConversionPatternsOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyGPUWwmaToNVVMConversionPatternsOp ApplyGPUWwmaToNVVMConversionPatternsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyGPUWwmaToNVVMConversionPatternsOp::verifyInvariantsImpl() {
  return ::mlir::success();
}

::llvm::LogicalResult ApplyGPUWwmaToNVVMConversionPatternsOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyGPUWwmaToNVVMConversionPatternsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyGPUWwmaToNVVMConversionPatternsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyGPUWwmaToNVVMConversionPatternsOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::ApplyUnrollVectorsSubgroupMmaOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

ApplyUnrollVectorsSubgroupMmaOpGenericAdaptorBase::ApplyUnrollVectorsSubgroupMmaOpGenericAdaptorBase(ApplyUnrollVectorsSubgroupMmaOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

uint64_t ApplyUnrollVectorsSubgroupMmaOpGenericAdaptorBase::getM() {
  auto attr = getMAttr();
  return attr.getValue().getZExtValue();
}

uint64_t ApplyUnrollVectorsSubgroupMmaOpGenericAdaptorBase::getN() {
  auto attr = getNAttr();
  return attr.getValue().getZExtValue();
}

uint64_t ApplyUnrollVectorsSubgroupMmaOpGenericAdaptorBase::getK() {
  auto attr = getKAttr();
  return attr.getValue().getZExtValue();
}


} // namespace detail
ApplyUnrollVectorsSubgroupMmaOpAdaptor::ApplyUnrollVectorsSubgroupMmaOpAdaptor(ApplyUnrollVectorsSubgroupMmaOp op) : ApplyUnrollVectorsSubgroupMmaOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOpAdaptor::verify(::mlir::Location loc) {
  auto tblgen_k = getProperties().k; (void)tblgen_k;
  if (!tblgen_k) return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op requires attribute 'k'");
  auto tblgen_m = getProperties().m; (void)tblgen_m;
  if (!tblgen_m) return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op requires attribute 'm'");
  auto tblgen_n = getProperties().n; (void)tblgen_n;
  if (!tblgen_n) return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op requires attribute 'n'");

  if (tblgen_m && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(64)))))
    return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op attribute 'm' failed to satisfy constraint: 64-bit signless integer attribute");

  if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(64)))))
    return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op attribute 'n' failed to satisfy constraint: 64-bit signless integer attribute");

  if (tblgen_k && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(64)))))
    return emitError(loc, "'transform.apply_patterns.gpu.unroll_vectors_subgroup_mma' op attribute 'k' failed to satisfy constraint: 64-bit signless integer attribute");
  return ::mlir::success();
}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.k;
       auto attr = dict.get("k");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `k` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }

  {
    auto &propStorage = prop.m;
       auto attr = dict.get("m");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `m` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }

  {
    auto &propStorage = prop.n;
       auto attr = dict.get("n");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `n` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute ApplyUnrollVectorsSubgroupMmaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.k;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("k",
                                       propStorage));
    }

    {
      const auto &propStorage = prop.m;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("m",
                                       propStorage));
    }

    {
      const auto &propStorage = prop.n;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("n",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code ApplyUnrollVectorsSubgroupMmaOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.k.getAsOpaquePointer()), 
    llvm::hash_value(prop.m.getAsOpaquePointer()), 
    llvm::hash_value(prop.n.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> ApplyUnrollVectorsSubgroupMmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "k")
      return prop.k;

    if (name == "m")
      return prop.m;

    if (name == "n")
      return prop.n;
  return std::nullopt;
}

void ApplyUnrollVectorsSubgroupMmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "k") {
       prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
       return;
    }

    if (name == "m") {
       prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
       return;
    }

    if (name == "n") {
       prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
       return;
    }
}

void ApplyUnrollVectorsSubgroupMmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.k) attrs.append("k", prop.k);

    if (prop.m) attrs.append("m", prop.m);

    if (prop.n) attrs.append("n", prop.n);
}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getKAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(attr, "k", emitError)))
        return ::mlir::failure();
    }

    {
      ::mlir::Attribute attr = attrs.get(getMAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(attr, "m", emitError)))
        return ::mlir::failure();
    }

    {
      ::mlir::Attribute attr = attrs.get(getNAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(attr, "n", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readAttribute(prop.k)))
    return ::mlir::failure();

  if (::mlir::failed(reader.readAttribute(prop.m)))
    return ::mlir::failure();

  if (::mlir::failed(reader.readAttribute(prop.n)))
    return ::mlir::failure();
  return ::mlir::success();
}

void ApplyUnrollVectorsSubgroupMmaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;
  writer.writeAttribute(prop.k);
  writer.writeAttribute(prop.m);
  writer.writeAttribute(prop.n);
}

uint64_t ApplyUnrollVectorsSubgroupMmaOp::getM() {
  auto attr = getMAttr();
  return attr.getValue().getZExtValue();
}

uint64_t ApplyUnrollVectorsSubgroupMmaOp::getN() {
  auto attr = getNAttr();
  return attr.getValue().getZExtValue();
}

uint64_t ApplyUnrollVectorsSubgroupMmaOp::getK() {
  auto attr = getKAttr();
  return attr.getValue().getZExtValue();
}

void ApplyUnrollVectorsSubgroupMmaOp::setM(uint64_t attrValue) {
  getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue);
}

void ApplyUnrollVectorsSubgroupMmaOp::setN(uint64_t attrValue) {
  getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue);
}

void ApplyUnrollVectorsSubgroupMmaOp::setK(uint64_t attrValue) {
  getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue);
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  odsState.getOrAddProperties<Properties>().m = m;
  odsState.getOrAddProperties<Properties>().n = n;
  odsState.getOrAddProperties<Properties>().k = k;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  odsState.getOrAddProperties<Properties>().m = m;
  odsState.getOrAddProperties<Properties>().n = n;
  odsState.getOrAddProperties<Properties>().k = k;
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t m, uint64_t n, uint64_t k) {
  odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), m);
  odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), n);
  odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), k);
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint64_t m, uint64_t n, uint64_t k) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, uint64_t m, uint64_t n, uint64_t k) {
  return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t m, uint64_t n, uint64_t k) {
  odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), m);
  odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), n);
  odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), k);
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint64_t m, uint64_t n, uint64_t k) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint64_t m, uint64_t n, uint64_t k) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k));
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<ApplyUnrollVectorsSubgroupMmaOp::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void ApplyUnrollVectorsSubgroupMmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<ApplyUnrollVectorsSubgroupMmaOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

ApplyUnrollVectorsSubgroupMmaOp ApplyUnrollVectorsSubgroupMmaOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOp::verifyInvariantsImpl() {
  auto tblgen_k = getProperties().k; (void)tblgen_k;
  if (!tblgen_k) return emitOpError("requires attribute 'k'");
  auto tblgen_m = getProperties().m; (void)tblgen_m;
  if (!tblgen_m) return emitOpError("requires attribute 'm'");
  auto tblgen_n = getProperties().n; (void)tblgen_n;
  if (!tblgen_n) return emitOpError("requires attribute 'n'");

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(*this, tblgen_m, "m")))
    return ::mlir::failure();

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(*this, tblgen_n, "n")))
    return ::mlir::failure();

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(*this, tblgen_k, "k")))
    return ::mlir::failure();
  return ::mlir::success();
}

::llvm::LogicalResult ApplyUnrollVectorsSubgroupMmaOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult ApplyUnrollVectorsSubgroupMmaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  ::mlir::IntegerAttr mAttr;
  ::mlir::IntegerAttr nAttr;
  ::mlir::IntegerAttr kAttr;
  if (parser.parseLSquare())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(mAttr, parser.getBuilder().getIntegerType(64))) {
    return ::mlir::failure();
  }
  if (mAttr) result.getOrAddProperties<ApplyUnrollVectorsSubgroupMmaOp::Properties>().m = mAttr;
  if (parser.parseComma())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(nAttr, parser.getBuilder().getIntegerType(64))) {
    return ::mlir::failure();
  }
  if (nAttr) result.getOrAddProperties<ApplyUnrollVectorsSubgroupMmaOp::Properties>().n = nAttr;
  if (parser.parseComma())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(kAttr, parser.getBuilder().getIntegerType(64))) {
    return ::mlir::failure();
  }
  if (kAttr) result.getOrAddProperties<ApplyUnrollVectorsSubgroupMmaOp::Properties>().k = kAttr;
  if (parser.parseRSquare())
    return ::mlir::failure();
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void ApplyUnrollVectorsSubgroupMmaOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  _odsPrinter << "[";
  _odsPrinter.printAttributeWithoutType(getMAttr());
  _odsPrinter << ",";
  _odsPrinter << ' ';
  _odsPrinter.printAttributeWithoutType(getNAttr());
  _odsPrinter << ",";
  _odsPrinter << ' ';
  _odsPrinter.printAttributeWithoutType(getKAttr());
  _odsPrinter << "]";
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  elidedAttrs.push_back("m");
  elidedAttrs.push_back("n");
  elidedAttrs.push_back("k");
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::ApplyUnrollVectorsSubgroupMmaOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::EliminateBarriersOp definitions
//===----------------------------------------------------------------------===//

namespace detail {

EliminateBarriersOpGenericAdaptorBase::EliminateBarriersOpGenericAdaptorBase(EliminateBarriersOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}


} // namespace detail
EliminateBarriersOpAdaptor::EliminateBarriersOpAdaptor(EliminateBarriersOp op) : EliminateBarriersOpGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult EliminateBarriersOpAdaptor::verify(::mlir::Location loc) {
  return ::mlir::success();
}

::llvm::LogicalResult EliminateBarriersOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }
      return ::mlir::success();
}

::mlir::Attribute EliminateBarriersOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code EliminateBarriersOp::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine();
}

std::optional<mlir::Attribute> EliminateBarriersOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
  return std::nullopt;
}

void EliminateBarriersOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}

void EliminateBarriersOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}

::llvm::LogicalResult EliminateBarriersOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    return ::mlir::success();
}

void EliminateBarriersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__);
  auto __res__ = ::llvm::dyn_cast<EliminateBarriersOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::ImplicitLocOpBuilder &builder) {
  return create(builder, builder.getLoc());
}

void EliminateBarriersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
  assert(resultTypes.size() == 0u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
  auto __res__ = ::llvm::dyn_cast<EliminateBarriersOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}

void EliminateBarriersOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<EliminateBarriersOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void EliminateBarriersOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 0u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 0u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<EliminateBarriersOp>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

EliminateBarriersOp EliminateBarriersOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult EliminateBarriersOp::verifyInvariantsImpl() {
  return ::mlir::success();
}

::llvm::LogicalResult EliminateBarriersOp::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult EliminateBarriersOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  return ::mlir::success();
}

void EliminateBarriersOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::EliminateBarriersOp)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::MapForallToBlocks definitions
//===----------------------------------------------------------------------===//

namespace detail {

MapForallToBlocksGenericAdaptorBase::MapForallToBlocksGenericAdaptorBase(MapForallToBlocks op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

::mlir::DenseI64ArrayAttr MapForallToBlocksGenericAdaptorBase::getGridDimsAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI64ArrayAttr>(getProperties().grid_dims);
  if (!attr)
    attr = ::mlir::Builder(odsAttrs.getContext()).getDenseI64ArrayAttr({});
  return attr;
}

::llvm::ArrayRef<int64_t> MapForallToBlocksGenericAdaptorBase::getGridDims() {
  auto attr = getGridDimsAttr();
    if (!attr)
      return ::mlir::Builder(odsAttrs.getContext()).getDenseI64ArrayAttr({});
  return attr;
}

::mlir::UnitAttr MapForallToBlocksGenericAdaptorBase::getGenerateGpuLaunchAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().generate_gpu_launch);
  if (!attr)
    attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
  return attr;
}

bool MapForallToBlocksGenericAdaptorBase::getGenerateGpuLaunch() {
  auto attr = getGenerateGpuLaunchAttr();
    if (!attr)
      return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
  return attr != nullptr;
}


} // namespace detail
MapForallToBlocksAdaptor::MapForallToBlocksAdaptor(MapForallToBlocks op) : MapForallToBlocksGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult MapForallToBlocksAdaptor::verify(::mlir::Location loc) {
  auto tblgen_generate_gpu_launch = getProperties().generate_gpu_launch; (void)tblgen_generate_gpu_launch;
  auto tblgen_grid_dims = getProperties().grid_dims; (void)tblgen_grid_dims;

  if (tblgen_grid_dims && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_grid_dims))))
    return emitError(loc, "'transform.gpu.map_forall_to_blocks' op attribute 'grid_dims' failed to satisfy constraint: i64 dense array attribute");

  if (tblgen_generate_gpu_launch && !((::llvm::isa<::mlir::UnitAttr>(tblgen_generate_gpu_launch))))
    return emitError(loc, "'transform.gpu.map_forall_to_blocks' op attribute 'generate_gpu_launch' failed to satisfy constraint: unit attribute");
  return ::mlir::success();
}

::llvm::LogicalResult MapForallToBlocks::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.generate_gpu_launch;
       auto attr = dict.get("generate_gpu_launch");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `generate_gpu_launch` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }

  {
    auto &propStorage = prop.grid_dims;
       auto attr = dict.get("grid_dims");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `grid_dims` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute MapForallToBlocks::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.generate_gpu_launch;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("generate_gpu_launch",
                                       propStorage));
    }

    {
      const auto &propStorage = prop.grid_dims;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("grid_dims",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code MapForallToBlocks::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.generate_gpu_launch.getAsOpaquePointer()), 
    llvm::hash_value(prop.grid_dims.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> MapForallToBlocks::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "generate_gpu_launch")
      return prop.generate_gpu_launch;

    if (name == "grid_dims")
      return prop.grid_dims;
  return std::nullopt;
}

void MapForallToBlocks::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "generate_gpu_launch") {
       prop.generate_gpu_launch = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.generate_gpu_launch)>>(value);
       return;
    }

    if (name == "grid_dims") {
       prop.grid_dims = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.grid_dims)>>(value);
       return;
    }
}

void MapForallToBlocks::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.generate_gpu_launch) attrs.append("generate_gpu_launch", prop.generate_gpu_launch);

    if (prop.grid_dims) attrs.append("grid_dims", prop.grid_dims);
}

::llvm::LogicalResult MapForallToBlocks::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getGenerateGpuLaunchAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps5(attr, "generate_gpu_launch", emitError)))
        return ::mlir::failure();
    }

    {
      ::mlir::Attribute attr = attrs.get(getGridDimsAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps4(attr, "grid_dims", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult MapForallToBlocks::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readOptionalAttribute(prop.generate_gpu_launch)))
    return ::mlir::failure();

  if (::mlir::failed(reader.readOptionalAttribute(prop.grid_dims)))
    return ::mlir::failure();
  return ::mlir::success();
}

void MapForallToBlocks::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;

  writer.writeOptionalAttribute(prop.generate_gpu_launch);

  writer.writeOptionalAttribute(prop.grid_dims);
}

::llvm::ArrayRef<int64_t> MapForallToBlocks::getGridDims() {
  auto attr = getGridDimsAttr();
    if (!attr)
      return ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr({});
  return attr;
}

bool MapForallToBlocks::getGenerateGpuLaunch() {
  auto attr = getGenerateGpuLaunchAttr();
    if (!attr)
      return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
  return attr != nullptr;
}

void MapForallToBlocks::setGridDims(::std::optional<::llvm::ArrayRef<int64_t>> attrValue) {
    auto &odsProp = getProperties().grid_dims;
    if (attrValue)
      odsProp = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(*attrValue);
    else
      odsProp = nullptr;
}

void MapForallToBlocks::setGenerateGpuLaunch(bool attrValue) {
    auto &odsProp = getProperties().generate_gpu_launch;
    if (attrValue)
      odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
    else
      odsProp = nullptr;
}

void MapForallToBlocks::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  odsState.addOperands(target);
  if (grid_dims) {
    odsState.getOrAddProperties<Properties>().grid_dims = grid_dims;
  }
  if (generate_gpu_launch) {
    odsState.getOrAddProperties<Properties>().generate_gpu_launch = generate_gpu_launch;
  }
  odsState.addTypes(result);
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
}

void MapForallToBlocks::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  odsState.addOperands(target);
  if (grid_dims) {
    odsState.getOrAddProperties<Properties>().grid_dims = grid_dims;
  }
  if (generate_gpu_launch) {
    odsState.getOrAddProperties<Properties>().generate_gpu_launch = generate_gpu_launch;
  }
  assert(resultTypes.size() == 1u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::mlir::DenseI64ArrayAttr grid_dims, /*optional*/::mlir::UnitAttr generate_gpu_launch) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
}

void MapForallToBlocks::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  odsState.addOperands(target);
  odsState.getOrAddProperties<Properties>().grid_dims = odsBuilder.getDenseI64ArrayAttr(grid_dims);
  if (generate_gpu_launch) {
    odsState.getOrAddProperties<Properties>().generate_gpu_launch = ((generate_gpu_launch) ? odsBuilder.getUnitAttr() : nullptr);
  }
  odsState.addTypes(result);
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
}

void MapForallToBlocks::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  odsState.addOperands(target);
  odsState.getOrAddProperties<Properties>().grid_dims = odsBuilder.getDenseI64ArrayAttr(grid_dims);
  if (generate_gpu_launch) {
    odsState.getOrAddProperties<Properties>().generate_gpu_launch = ((generate_gpu_launch) ? odsBuilder.getUnitAttr() : nullptr);
  }
  assert(resultTypes.size() == 1u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value target, /*optional*/::llvm::ArrayRef<int64_t> grid_dims, /*optional*/bool generate_gpu_launch) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(grid_dims)>(grid_dims), std::forward<decltype(generate_gpu_launch)>(generate_gpu_launch));
}

void MapForallToBlocks::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 1u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 1u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<MapForallToBlocks::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void MapForallToBlocks::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 1u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 1u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

MapForallToBlocks MapForallToBlocks::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<MapForallToBlocks>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapForallToBlocks MapForallToBlocks::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

::llvm::LogicalResult MapForallToBlocks::verifyInvariantsImpl() {
  auto tblgen_generate_gpu_launch = getProperties().generate_gpu_launch; (void)tblgen_generate_gpu_launch;
  auto tblgen_grid_dims = getProperties().grid_dims; (void)tblgen_grid_dims;

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps4(*this, tblgen_grid_dims, "grid_dims")))
    return ::mlir::failure();

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps5(*this, tblgen_generate_gpu_launch, "generate_gpu_launch")))
    return ::mlir::failure();
  {
    unsigned index = 0; (void)index;
    auto valueGroup0 = getODSOperands(0);

    for (auto v : valueGroup0) {
      if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps1(*this, v.getType(), "operand", index++)))
        return ::mlir::failure();
    }
  }
  {
    unsigned index = 0; (void)index;
    auto valueGroup0 = getODSResults(0);

    for (auto v : valueGroup0) {
      if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps1(*this, v.getType(), "result", index++)))
        return ::mlir::failure();
    }
  }
  return ::mlir::success();
}

::llvm::LogicalResult MapForallToBlocks::verifyInvariants() {
  if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
    return ::mlir::success();
  return ::mlir::failure();
}

::mlir::ParseResult MapForallToBlocks::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  ::mlir::OpAsmParser::UnresolvedOperand targetRawOperand{};
  ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> targetOperands(&targetRawOperand, 1);  ::llvm::SMLoc targetOperandsLoc;
  (void)targetOperandsLoc;
  ::mlir::DenseI64ArrayAttr grid_dimsAttr;
  ::llvm::ArrayRef<::mlir::Type> targetTypes;
  ::llvm::ArrayRef<::mlir::Type> resultTypes;

  targetOperandsLoc = parser.getCurrentLocation();
  if (parser.parseOperand(targetRawOperand))
    return ::mlir::failure();
  if (::mlir::succeeded(parser.parseOptionalKeyword("generate_gpu_launch"))) {
    result.getOrAddProperties<MapForallToBlocks::Properties>().generate_gpu_launch = parser.getBuilder().getUnitAttr();  }
  if (::mlir::succeeded(parser.parseOptionalKeyword("grid_dims"))) {
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(grid_dimsAttr, ::mlir::Type{})) {
    return ::mlir::failure();
  }
  if (grid_dimsAttr) result.getOrAddProperties<MapForallToBlocks::Properties>().grid_dims = grid_dimsAttr;
  }
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  if (parser.parseColon())
    return ::mlir::failure();

  ::mlir::FunctionType target__result_functionType;
  if (parser.parseType(target__result_functionType))
    return ::mlir::failure();
  targetTypes = target__result_functionType.getInputs();
  resultTypes = target__result_functionType.getResults();
  result.addTypes(resultTypes);
  if (parser.resolveOperands(targetOperands, targetTypes, targetOperandsLoc, result.operands))
    return ::mlir::failure();
  return ::mlir::success();
}

void MapForallToBlocks::print(::mlir::OpAsmPrinter &_odsPrinter) {
  _odsPrinter << ' ';
  _odsPrinter << getTarget();
  if ((getGenerateGpuLaunchAttr() && getGenerateGpuLaunchAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
    _odsPrinter << ' ' << "generate_gpu_launch";
  }
  if ((getGridDimsAttr() && getGridDimsAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI64ArrayAttr({}))) {
    _odsPrinter << ' ' << "grid_dims";
    _odsPrinter << ' ' << "=";
    _odsPrinter << ' ';
  _odsPrinter.printStrippedAttrOrType(getGridDimsAttr());
  }
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  elidedAttrs.push_back("generate_gpu_launch");
  elidedAttrs.push_back("grid_dims");
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getGridDimsAttr();
     if(attr && (attr == odsBuilder.getDenseI64ArrayAttr({})))
       elidedAttrs.push_back("grid_dims");
  }
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getGenerateGpuLaunchAttr();
     if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
       elidedAttrs.push_back("generate_gpu_launch");
  }
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
  _odsPrinter << ' ' << ":";
  _odsPrinter << ' ';
  _odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getTarget().getType()), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::MapForallToBlocks)

namespace mlir::transform {


//===----------------------------------------------------------------------===//
// ::mlir::transform::MapNestedForallToThreads definitions
//===----------------------------------------------------------------------===//

namespace detail {

MapNestedForallToThreadsGenericAdaptorBase::MapNestedForallToThreadsGenericAdaptorBase(MapNestedForallToThreads op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}

::mlir::DenseI64ArrayAttr MapNestedForallToThreadsGenericAdaptorBase::getBlockDimsAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI64ArrayAttr>(getProperties().block_dims);
  return attr;
}

::llvm::ArrayRef<int64_t> MapNestedForallToThreadsGenericAdaptorBase::getBlockDims() {
  auto attr = getBlockDimsAttr();
  return attr;
}

::mlir::BoolAttr MapNestedForallToThreadsGenericAdaptorBase::getSyncAfterDistributeAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().sync_after_distribute);
  return attr;
}

bool MapNestedForallToThreadsGenericAdaptorBase::getSyncAfterDistribute() {
  auto attr = getSyncAfterDistributeAttr();
  return attr.getValue();
}

::mlir::IntegerAttr MapNestedForallToThreadsGenericAdaptorBase::getWarpSizeAttr() {
  auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().warp_size);
  return attr;
}

uint64_t MapNestedForallToThreadsGenericAdaptorBase::getWarpSize() {
  auto attr = getWarpSizeAttr();
  return attr.getValue().getZExtValue();
}


} // namespace detail
MapNestedForallToThreadsAdaptor::MapNestedForallToThreadsAdaptor(MapNestedForallToThreads op) : MapNestedForallToThreadsGenericAdaptor(op->getOperands(), op) {}

::llvm::LogicalResult MapNestedForallToThreadsAdaptor::verify(::mlir::Location loc) {
  auto tblgen_block_dims = getProperties().block_dims; (void)tblgen_block_dims;
  auto tblgen_sync_after_distribute = getProperties().sync_after_distribute; (void)tblgen_sync_after_distribute;
  auto tblgen_warp_size = getProperties().warp_size; (void)tblgen_warp_size;

  if (tblgen_block_dims && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_block_dims))))
    return emitError(loc, "'transform.gpu.map_nested_forall_to_threads' op attribute 'block_dims' failed to satisfy constraint: i64 dense array attribute");

  if (tblgen_sync_after_distribute && !((::llvm::isa<::mlir::BoolAttr>(tblgen_sync_after_distribute))))
    return emitError(loc, "'transform.gpu.map_nested_forall_to_threads' op attribute 'sync_after_distribute' failed to satisfy constraint: bool attribute");

  if (tblgen_warp_size && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_warp_size))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_warp_size).getType().isSignlessInteger(64)))))
    return emitError(loc, "'transform.gpu.map_nested_forall_to_threads' op attribute 'warp_size' failed to satisfy constraint: 64-bit signless integer attribute");
  return ::mlir::success();
}

::llvm::LogicalResult MapNestedForallToThreads::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
  ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
  if (!dict) {
    emitError() << "expected DictionaryAttr to set properties";
    return ::mlir::failure();
  }

  {
    auto &propStorage = prop.block_dims;
       auto attr = dict.get("block_dims");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `block_dims` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }

  {
    auto &propStorage = prop.sync_after_distribute;
       auto attr = dict.get("sync_after_distribute");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `sync_after_distribute` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }

  {
    auto &propStorage = prop.warp_size;
       auto attr = dict.get("warp_size");
    if (attr) {
      auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
      if (convertedAttr) {
        propStorage = convertedAttr;
      } else {
        emitError() << "Invalid attribute `warp_size` in property conversion: " << attr;
        return ::mlir::failure();
      }
    }
  }
  return ::mlir::success();
}

::mlir::Attribute MapNestedForallToThreads::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
    ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
    ::mlir::Builder odsBuilder{ctx};

    {
      const auto &propStorage = prop.block_dims;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("block_dims",
                                       propStorage));
    }

    {
      const auto &propStorage = prop.sync_after_distribute;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("sync_after_distribute",
                                       propStorage));
    }

    {
      const auto &propStorage = prop.warp_size;
      if (propStorage)
        attrs.push_back(odsBuilder.getNamedAttr("warp_size",
                                       propStorage));
    }

  if (!attrs.empty())
    return odsBuilder.getDictionaryAttr(attrs);
  return {};
}

llvm::hash_code MapNestedForallToThreads::computePropertiesHash(const Properties &prop) {
  using llvm::hash_value;
  return llvm::hash_combine(
    llvm::hash_value(prop.block_dims.getAsOpaquePointer()), 
    llvm::hash_value(prop.sync_after_distribute.getAsOpaquePointer()), 
    llvm::hash_value(prop.warp_size.getAsOpaquePointer()));
}

std::optional<mlir::Attribute> MapNestedForallToThreads::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
    if (name == "block_dims")
      return prop.block_dims;

    if (name == "sync_after_distribute")
      return prop.sync_after_distribute;

    if (name == "warp_size")
      return prop.warp_size;
  return std::nullopt;
}

void MapNestedForallToThreads::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
    if (name == "block_dims") {
       prop.block_dims = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.block_dims)>>(value);
       return;
    }

    if (name == "sync_after_distribute") {
       prop.sync_after_distribute = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sync_after_distribute)>>(value);
       return;
    }

    if (name == "warp_size") {
       prop.warp_size = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.warp_size)>>(value);
       return;
    }
}

void MapNestedForallToThreads::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
    if (prop.block_dims) attrs.append("block_dims", prop.block_dims);

    if (prop.sync_after_distribute) attrs.append("sync_after_distribute", prop.sync_after_distribute);

    if (prop.warp_size) attrs.append("warp_size", prop.warp_size);
}

::llvm::LogicalResult MapNestedForallToThreads::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
    {
      ::mlir::Attribute attr = attrs.get(getBlockDimsAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps4(attr, "block_dims", emitError)))
        return ::mlir::failure();
    }

    {
      ::mlir::Attribute attr = attrs.get(getSyncAfterDistributeAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps6(attr, "sync_after_distribute", emitError)))
        return ::mlir::failure();
    }

    {
      ::mlir::Attribute attr = attrs.get(getWarpSizeAttrName(opName));
      if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(attr, "warp_size", emitError)))
        return ::mlir::failure();
    }
    return ::mlir::success();
}

::llvm::LogicalResult MapNestedForallToThreads::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
  auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
  if (::mlir::failed(reader.readOptionalAttribute(prop.block_dims)))
    return ::mlir::failure();

  if (::mlir::failed(reader.readOptionalAttribute(prop.sync_after_distribute)))
    return ::mlir::failure();

  if (::mlir::failed(reader.readOptionalAttribute(prop.warp_size)))
    return ::mlir::failure();
  return ::mlir::success();
}

void MapNestedForallToThreads::writeProperties(::mlir::DialectBytecodeWriter &writer) {
  auto &prop = getProperties(); (void)prop;

  writer.writeOptionalAttribute(prop.block_dims);

  writer.writeOptionalAttribute(prop.sync_after_distribute);

  writer.writeOptionalAttribute(prop.warp_size);
}

::llvm::ArrayRef<int64_t> MapNestedForallToThreads::getBlockDims() {
  auto attr = getBlockDimsAttr();
  return attr;
}

bool MapNestedForallToThreads::getSyncAfterDistribute() {
  auto attr = getSyncAfterDistributeAttr();
  return attr.getValue();
}

uint64_t MapNestedForallToThreads::getWarpSize() {
  auto attr = getWarpSizeAttr();
  return attr.getValue().getZExtValue();
}

void MapNestedForallToThreads::setBlockDims(::llvm::ArrayRef<int64_t> attrValue) {
  getProperties().block_dims = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}

void MapNestedForallToThreads::setSyncAfterDistribute(bool attrValue) {
  getProperties().sync_after_distribute = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
}

void MapNestedForallToThreads::setWarpSize(uint64_t attrValue) {
  getProperties().warp_size = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue);
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  odsState.addOperands(target);
  if (block_dims) {
    odsState.getOrAddProperties<Properties>().block_dims = block_dims;
  }
  if (sync_after_distribute) {
    odsState.getOrAddProperties<Properties>().sync_after_distribute = sync_after_distribute;
  }
  if (warp_size) {
    odsState.getOrAddProperties<Properties>().warp_size = warp_size;
  }
  odsState.addTypes(result);
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  odsState.addOperands(target);
  if (block_dims) {
    odsState.getOrAddProperties<Properties>().block_dims = block_dims;
  }
  if (sync_after_distribute) {
    odsState.getOrAddProperties<Properties>().sync_after_distribute = sync_after_distribute;
  }
  if (warp_size) {
    odsState.getOrAddProperties<Properties>().warp_size = warp_size;
  }
  assert(resultTypes.size() == 1u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::mlir::DenseI64ArrayAttr block_dims, ::mlir::BoolAttr sync_after_distribute, ::mlir::IntegerAttr warp_size) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  odsState.addOperands(target);
  odsState.getOrAddProperties<Properties>().block_dims = odsBuilder.getDenseI64ArrayAttr(block_dims);
  odsState.getOrAddProperties<Properties>().sync_after_distribute = odsBuilder.getBoolAttr(sync_after_distribute);
  odsState.getOrAddProperties<Properties>().warp_size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), warp_size);
  odsState.addTypes(result);
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  odsState.addOperands(target);
  odsState.getOrAddProperties<Properties>().block_dims = odsBuilder.getDenseI64ArrayAttr(block_dims);
  odsState.getOrAddProperties<Properties>().sync_after_distribute = odsBuilder.getBoolAttr(sync_after_distribute);
  odsState.getOrAddProperties<Properties>().warp_size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), warp_size);
  assert(resultTypes.size() == 1u && "mismatched number of results");
  odsState.addTypes(resultTypes);
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value target, ::llvm::ArrayRef<int64_t> block_dims, bool sync_after_distribute, uint64_t warp_size) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(target)>(target), std::forward<decltype(block_dims)>(block_dims), std::forward<decltype(sync_after_distribute)>(sync_after_distribute), std::forward<decltype(warp_size)>(warp_size));
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  assert(operands.size() == 1u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.addAttributes(attributes);
  assert(resultTypes.size() == 1u && "mismatched number of return types");
  odsState.addTypes(resultTypes);

  if (!attributes.empty()) {
    ::mlir::OpaqueProperties properties =
      &odsState.getOrAddProperties<MapNestedForallToThreads::Properties>();
    std::optional<::mlir::RegisteredOperationName> info =
      odsState.name.getRegisteredInfo();
    if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
        odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
      ::llvm::report_fatal_error("Property conversion failed.");
  }
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}

void MapNestedForallToThreads::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  assert(operands.size() == 1u && "mismatched number of parameters");
  odsState.addOperands(operands);
  odsState.useProperties(const_cast<Properties&>(properties));
  odsState.addAttributes(discardableAttributes);
  assert(resultTypes.size() == 1u && "mismatched number of return types");
  odsState.addTypes(resultTypes);
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  ::mlir::OperationState __state__(location, getOperationName());
  build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
  auto __res__ = ::llvm::dyn_cast<MapNestedForallToThreads>(builder.create(__state__));
  assert(__res__ && "builder didn't return the right type");
  return __res__;
}

MapNestedForallToThreads MapNestedForallToThreads::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
  return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}

void MapNestedForallToThreads::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
  ::mlir::Builder odsBuilder(opName.getContext());
  if (!properties.block_dims)
    properties.block_dims = odsBuilder.getDenseI64ArrayAttr({});
  if (!properties.sync_after_distribute)
    properties.sync_after_distribute = odsBuilder.getBoolAttr(true);
  if (!properties.warp_size)
    properties.warp_size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 32);
}

::llvm::LogicalResult MapNestedForallToThreads::verifyInvariantsImpl() {
  auto tblgen_block_dims = getProperties().block_dims; (void)tblgen_block_dims;
  auto tblgen_sync_after_distribute = getProperties().sync_after_distribute; (void)tblgen_sync_after_distribute;
  auto tblgen_warp_size = getProperties().warp_size; (void)tblgen_warp_size;

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps4(*this, tblgen_block_dims, "block_dims")))
    return ::mlir::failure();

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps6(*this, tblgen_sync_after_distribute, "sync_after_distribute")))
    return ::mlir::failure();

  if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps3(*this, tblgen_warp_size, "warp_size")))
    return ::mlir::failure();
  {
    unsigned index = 0; (void)index;
    auto valueGroup0 = getODSOperands(0);

    for (auto v : valueGroup0) {
      if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps1(*this, v.getType(), "operand", index++)))
        return ::mlir::failure();
    }
  }
  {
    unsigned index = 0; (void)index;
    auto valueGroup0 = getODSResults(0);

    for (auto v : valueGroup0) {
      if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps1(*this, v.getType(), "result", index++)))
        return ::mlir::failure();
    }
  }
  return ::mlir::success();
}

::llvm::LogicalResult MapNestedForallToThreads::verifyInvariants() {
  return verifyInvariantsImpl();
}

::mlir::ParseResult MapNestedForallToThreads::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
  ::mlir::OpAsmParser::UnresolvedOperand targetRawOperand{};
  ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> targetOperands(&targetRawOperand, 1);  ::llvm::SMLoc targetOperandsLoc;
  (void)targetOperandsLoc;
  ::mlir::DenseI64ArrayAttr block_dimsAttr;
  ::mlir::BoolAttr sync_after_distributeAttr;
  ::mlir::IntegerAttr warp_sizeAttr;
  ::llvm::ArrayRef<::mlir::Type> targetTypes;
  ::llvm::ArrayRef<::mlir::Type> resultTypes;

  targetOperandsLoc = parser.getCurrentLocation();
  if (parser.parseOperand(targetRawOperand))
    return ::mlir::failure();
  if (parser.parseKeyword("block_dims"))
    return ::mlir::failure();
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(block_dimsAttr, ::mlir::Type{})) {
    return ::mlir::failure();
  }
  if (block_dimsAttr) result.getOrAddProperties<MapNestedForallToThreads::Properties>().block_dims = block_dimsAttr;
  if (::mlir::succeeded(parser.parseOptionalKeyword("sync_after_distribute"))) {
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(sync_after_distributeAttr, parser.getBuilder().getIntegerType(1))) {
    return ::mlir::failure();
  }
  if (sync_after_distributeAttr) result.getOrAddProperties<MapNestedForallToThreads::Properties>().sync_after_distribute = sync_after_distributeAttr;
  }
  if (::mlir::succeeded(parser.parseOptionalKeyword("warp_size"))) {
  if (parser.parseEqual())
    return ::mlir::failure();

  if (parser.parseCustomAttributeWithFallback(warp_sizeAttr, parser.getBuilder().getIntegerType(64))) {
    return ::mlir::failure();
  }
  if (warp_sizeAttr) result.getOrAddProperties<MapNestedForallToThreads::Properties>().warp_size = warp_sizeAttr;
  }
  {
    auto loc = parser.getCurrentLocation();(void)loc;
    if (parser.parseOptionalAttrDict(result.attributes))
      return ::mlir::failure();
    if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
        return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
      })))
      return ::mlir::failure();
  }
  if (parser.parseColon())
    return ::mlir::failure();

  ::mlir::FunctionType target__result_functionType;
  if (parser.parseType(target__result_functionType))
    return ::mlir::failure();
  targetTypes = target__result_functionType.getInputs();
  resultTypes = target__result_functionType.getResults();
  result.addTypes(resultTypes);
  if (parser.resolveOperands(targetOperands, targetTypes, targetOperandsLoc, result.operands))
    return ::mlir::failure();
  return ::mlir::success();
}

void MapNestedForallToThreads::print(::mlir::OpAsmPrinter &_odsPrinter) {
  _odsPrinter << ' ';
  _odsPrinter << getTarget();
  _odsPrinter << ' ' << "block_dims";
  _odsPrinter << ' ' << "=";
  _odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getBlockDimsAttr());
  if (getSyncAfterDistributeAttr() != ::mlir::OpBuilder((*this)->getContext()).getBoolAttr(true)) {
    _odsPrinter << ' ' << "sync_after_distribute";
    _odsPrinter << ' ' << "=";
    _odsPrinter << ' ';
    _odsPrinter.printAttributeWithoutType(getSyncAfterDistributeAttr());
  }
  if (getWarpSizeAttr() != ::mlir::OpBuilder((*this)->getContext()).getIntegerAttr(::mlir::OpBuilder((*this)->getContext()).getIntegerType(64), 32)) {
    _odsPrinter << ' ' << "warp_size";
    _odsPrinter << ' ' << "=";
    _odsPrinter << ' ';
    _odsPrinter.printAttributeWithoutType(getWarpSizeAttr());
  }
  ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
  elidedAttrs.push_back("block_dims");
  elidedAttrs.push_back("sync_after_distribute");
  elidedAttrs.push_back("warp_size");
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getBlockDimsAttr();
     if(attr && (attr == odsBuilder.getDenseI64ArrayAttr({})))
       elidedAttrs.push_back("block_dims");
  }
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getSyncAfterDistributeAttr();
     if(attr && (attr == odsBuilder.getBoolAttr(true)))
       elidedAttrs.push_back("sync_after_distribute");
  }
  {
     ::mlir::Builder odsBuilder(getContext());
     ::mlir::Attribute attr = getWarpSizeAttr();
     if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 32)))
       elidedAttrs.push_back("warp_size");
  }
  _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
  _odsPrinter << ' ' << ":";
  _odsPrinter << ' ';
  _odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getTarget().getType()), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
}


} // namespace mlir::transform
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::transform::MapNestedForallToThreads)


#endif // GET_OP_CLASSES

