Clean up some compiler warnings on my machine.

pull/197/head
Sean Silva 2021-03-23 14:28:39 -07:00
parent 99178a167d
commit 641098be54
4 changed files with 13 additions and 21 deletions

View File

@ -76,15 +76,15 @@ static refbackrt::MutableArrayRef<T> toRefbackrt(llvm::MutableArrayRef<T> a) {
}
static std::string stringifyShape(refbackrt::ArrayRef<std::int32_t> extents) {
static constexpr char *kDynamicDimAsString = "?";
static constexpr char kDynamicDimAsString[] = "?";
std::stringstream ss;
ss << "(";
for (int i = 0; i < extents.size(); i++) {
for (int i = 0, e = extents.size(); i < e; i++) {
if (extents[i] < 0)
ss << kDynamicDimAsString;
else
ss << extents[i];
if (i != extents.size() - 1)
if (i != e - 1)
ss << "x";
}
ss << ")";
@ -135,8 +135,8 @@ JITModule::invoke(llvm::StringRef functionName,
// Tag::kNone) currently without passing the ArgInfo structs down to the
// Runtime level, so we deal with the output type creation here.
for (int i = 0; i < metadata.numOutputs; i++) {
outputs[i] = std::move(
refbackrt::createRtValueFromOutputArgInfo(metadata.outputArgInfos[i]));
outputs[i] =
refbackrt::createRtValueFromOutputArgInfo(metadata.outputArgInfos[i]);
}
refbackrt::invoke(

View File

@ -307,7 +307,7 @@ createFuncDescriptorArray(ArrayRef<refbackrt::FuncMetadataOp> funcMetadatas,
Value inputDescriptorArray =
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
if (!funcMetadata.inputArgTypes().hasValue())
funcMetadata.emitError()
@ -365,7 +365,7 @@ createFuncDescriptorArray(ArrayRef<refbackrt::FuncMetadataOp> funcMetadatas,
Value outputDescriptorArray =
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())
funcMetadata.emitError()
<< "numOutputs > 0 but there are no outputArgTypes?";
@ -599,11 +599,6 @@ static Type getUnrankedMemrefDescriptorType(MLIRContext *context) {
/*memorySpace=*/0));
}
static Type getDoubleType(MLIRContext *context) {
LLVMTypeConverter converter(context);
return converter.convertType(FloatType::getF64(context));
}
static Type getFloatType(MLIRContext *context) {
LLVMTypeConverter converter(context);
return converter.convertType(FloatType::getF32(context));

View File

@ -358,8 +358,6 @@ getExternalInputArgInfo(const refbackrt::InputDescriptor &inputDescriptor) {
ret.argType = ArgType::kF64;
ret.elementType = ElementType::NONE;
break;
default:
assert(false && "need to update external internal map");
}
// Extract shape information
@ -393,8 +391,6 @@ getExternalOutputArgInfo(const refbackrt::OutputDescriptor &outputDescriptor) {
ret.argType = ArgType::kF64;
ret.elementType = ElementType::NONE;
break;
default:
assert(false && "need to update external internal map");
}
// Extract shape information
@ -516,4 +512,4 @@ RtValue refbackrt::createRtValueFromOutputArgInfo(const OutputArgInfo &info) {
return RtValue();
}
}
}
}

View File

@ -96,8 +96,9 @@ static Type convertToMLIRType(refbackrt::ElementType type, Builder &builder) {
switch (type) {
case refbackrt::ElementType::F32:
return builder.getF32Type();
default:
llvm_unreachable("unsupported dtype");
}
llvm_unreachable("unsupported dtype");
}
static RankedTensorType getCorrespondingMLIRTensorType(refbackrt::Tensor &tensor,
@ -122,13 +123,13 @@ static Attribute convertToMLIRAttribute(const refbackrt::RtValue &value,
values.push_back(basePtr[i]);
return DenseFPElementsAttr::get(type, values);
}
default:
llvm_unreachable("unsupported element type");
}
} else if (value.isFloat()) {
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) {