in lib/bef_converter/bef_to_mlir/bef_attr_reader.cc [33:85]
static mlir::Type DecodeTypeAttribute(mlir::Builder* builder,
DType attribute_type) {
switch (attribute_type) {
case DType::I1:
return builder->getIntegerType(1);
case DType::I8:
return builder->getIntegerType(8);
case DType::I16:
return builder->getIntegerType(16);
case DType::I32:
return builder->getIntegerType(32);
case DType::I64:
return builder->getIntegerType(64);
case DType::UI8:
return builder->getIntegerType(8, /*isSigned=*/false);
case DType::UI16:
return builder->getIntegerType(16, /*isSigned=*/false);
case DType::UI32:
return builder->getIntegerType(32, /*isSigned=*/false);
case DType::UI64:
return builder->getIntegerType(64, /*isSigned=*/false);
case DType::BF16:
return builder->getBF16Type();
case DType::F16:
return builder->getF16Type();
case DType::F32:
return builder->getF32Type();
case DType::F64:
return builder->getF64Type();
case DType::Complex64:
return mlir::ComplexType::get(builder->getF32Type());
case DType::Complex128:
return mlir::ComplexType::get(builder->getF64Type());
case DType::String:
return tfrt::corert::StringType::get(builder->getContext());
case DType::Resource:
return tfrt::corert::ResourceType::get(builder->getContext());
case DType::Variant:
return tfrt::corert::VariantType::get(builder->getContext());
case DType::QUI8:
return tfrt::corert::Quint8Type::get(builder->getContext());
case DType::QUI16:
return tfrt::corert::Quint16Type::get(builder->getContext());
case DType::QI8:
return tfrt::corert::Qint8Type::get(builder->getContext());
case DType::QI16:
return tfrt::corert::Qint16Type::get(builder->getContext());
case DType::QI32:
return tfrt::corert::Qint32Type::get(builder->getContext());
default:
llvm_unreachable("unknown type attribute.");
}
}