mirror of https://github.com/llvm/torch-mlir
Clean up some compiler warnings on my machine.
parent
99178a167d
commit
641098be54
|
@ -76,15 +76,15 @@ static refbackrt::MutableArrayRef<T> toRefbackrt(llvm::MutableArrayRef<T> a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string stringifyShape(refbackrt::ArrayRef<std::int32_t> extents) {
|
static std::string stringifyShape(refbackrt::ArrayRef<std::int32_t> extents) {
|
||||||
static constexpr char *kDynamicDimAsString = "?";
|
static constexpr char kDynamicDimAsString[] = "?";
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "(";
|
ss << "(";
|
||||||
for (int i = 0; i < extents.size(); i++) {
|
for (int i = 0, e = extents.size(); i < e; i++) {
|
||||||
if (extents[i] < 0)
|
if (extents[i] < 0)
|
||||||
ss << kDynamicDimAsString;
|
ss << kDynamicDimAsString;
|
||||||
else
|
else
|
||||||
ss << extents[i];
|
ss << extents[i];
|
||||||
if (i != extents.size() - 1)
|
if (i != e - 1)
|
||||||
ss << "x";
|
ss << "x";
|
||||||
}
|
}
|
||||||
ss << ")";
|
ss << ")";
|
||||||
|
@ -135,8 +135,8 @@ JITModule::invoke(llvm::StringRef functionName,
|
||||||
// Tag::kNone) currently without passing the ArgInfo structs down to the
|
// Tag::kNone) currently without passing the ArgInfo structs down to the
|
||||||
// Runtime level, so we deal with the output type creation here.
|
// Runtime level, so we deal with the output type creation here.
|
||||||
for (int i = 0; i < metadata.numOutputs; i++) {
|
for (int i = 0; i < metadata.numOutputs; i++) {
|
||||||
outputs[i] = std::move(
|
outputs[i] =
|
||||||
refbackrt::createRtValueFromOutputArgInfo(metadata.outputArgInfos[i]));
|
refbackrt::createRtValueFromOutputArgInfo(metadata.outputArgInfos[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
refbackrt::invoke(
|
refbackrt::invoke(
|
||||||
|
|
|
@ -307,7 +307,7 @@ createFuncDescriptorArray(ArrayRef<refbackrt::FuncMetadataOp> funcMetadatas,
|
||||||
Value inputDescriptorArray =
|
Value inputDescriptorArray =
|
||||||
builder.create<LLVM::UndefOp>(loc, inputDescriptorArrayTy);
|
builder.create<LLVM::UndefOp>(loc, inputDescriptorArrayTy);
|
||||||
|
|
||||||
for (int i = 0; i < funcMetadata.numInputs(); i++) {
|
for (int i = 0, e = funcMetadata.numInputs(); i < e; i++) {
|
||||||
// Arg Type
|
// Arg Type
|
||||||
if (!funcMetadata.inputArgTypes().hasValue())
|
if (!funcMetadata.inputArgTypes().hasValue())
|
||||||
funcMetadata.emitError()
|
funcMetadata.emitError()
|
||||||
|
@ -365,7 +365,7 @@ createFuncDescriptorArray(ArrayRef<refbackrt::FuncMetadataOp> funcMetadatas,
|
||||||
Value outputDescriptorArray =
|
Value outputDescriptorArray =
|
||||||
builder.create<LLVM::UndefOp>(loc, outputDescriptorArrayTy);
|
builder.create<LLVM::UndefOp>(loc, outputDescriptorArrayTy);
|
||||||
|
|
||||||
for (int i = 0; i < funcMetadata.numOutputs(); i++) {
|
for (int i = 0, e = funcMetadata.numOutputs(); i < e; i++) {
|
||||||
if (!funcMetadata.outputArgTypes().hasValue())
|
if (!funcMetadata.outputArgTypes().hasValue())
|
||||||
funcMetadata.emitError()
|
funcMetadata.emitError()
|
||||||
<< "numOutputs > 0 but there are no outputArgTypes?";
|
<< "numOutputs > 0 but there are no outputArgTypes?";
|
||||||
|
@ -599,11 +599,6 @@ static Type getUnrankedMemrefDescriptorType(MLIRContext *context) {
|
||||||
/*memorySpace=*/0));
|
/*memorySpace=*/0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Type getDoubleType(MLIRContext *context) {
|
|
||||||
LLVMTypeConverter converter(context);
|
|
||||||
return converter.convertType(FloatType::getF64(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Type getFloatType(MLIRContext *context) {
|
static Type getFloatType(MLIRContext *context) {
|
||||||
LLVMTypeConverter converter(context);
|
LLVMTypeConverter converter(context);
|
||||||
return converter.convertType(FloatType::getF32(context));
|
return converter.convertType(FloatType::getF32(context));
|
||||||
|
|
|
@ -358,8 +358,6 @@ getExternalInputArgInfo(const refbackrt::InputDescriptor &inputDescriptor) {
|
||||||
ret.argType = ArgType::kF64;
|
ret.argType = ArgType::kF64;
|
||||||
ret.elementType = ElementType::NONE;
|
ret.elementType = ElementType::NONE;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
assert(false && "need to update external internal map");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract shape information
|
// Extract shape information
|
||||||
|
@ -393,8 +391,6 @@ getExternalOutputArgInfo(const refbackrt::OutputDescriptor &outputDescriptor) {
|
||||||
ret.argType = ArgType::kF64;
|
ret.argType = ArgType::kF64;
|
||||||
ret.elementType = ElementType::NONE;
|
ret.elementType = ElementType::NONE;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
assert(false && "need to update external internal map");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract shape information
|
// Extract shape information
|
||||||
|
|
|
@ -96,8 +96,9 @@ static Type convertToMLIRType(refbackrt::ElementType type, Builder &builder) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case refbackrt::ElementType::F32:
|
case refbackrt::ElementType::F32:
|
||||||
return builder.getF32Type();
|
return builder.getF32Type();
|
||||||
|
default:
|
||||||
|
llvm_unreachable("unsupported dtype");
|
||||||
}
|
}
|
||||||
llvm_unreachable("unsupported dtype");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RankedTensorType getCorrespondingMLIRTensorType(refbackrt::Tensor &tensor,
|
static RankedTensorType getCorrespondingMLIRTensorType(refbackrt::Tensor &tensor,
|
||||||
|
@ -122,13 +123,13 @@ static Attribute convertToMLIRAttribute(const refbackrt::RtValue &value,
|
||||||
values.push_back(basePtr[i]);
|
values.push_back(basePtr[i]);
|
||||||
return DenseFPElementsAttr::get(type, values);
|
return DenseFPElementsAttr::get(type, values);
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
llvm_unreachable("unsupported element type");
|
||||||
}
|
}
|
||||||
} else if (value.isFloat()) {
|
} else if (value.isFloat()) {
|
||||||
return builder.getF32FloatAttr(value.toFloat());
|
return builder.getF32FloatAttr(value.toFloat());
|
||||||
} else {
|
|
||||||
assert(false && "could not convert value to mlir attribute");
|
|
||||||
}
|
}
|
||||||
llvm_unreachable("unsupported dtype");
|
llvm_unreachable("unsupported type");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printOutput(const refbackrt::RtValue &value, llvm::raw_ostream &os) {
|
static void printOutput(const refbackrt::RtValue &value, llvm::raw_ostream &os) {
|
||||||
|
|
Loading…
Reference in New Issue