From 47ffc90db49f16c126c1fa456b92e24161847afb Mon Sep 17 00:00:00 2001 From: James Newling Date: Thu, 11 Jan 2024 09:46:46 -0800 Subject: [PATCH] signed/unsigned c++ compiler warning fixes (#2742) --- include/torch-mlir/Conversion/TorchOnnxToTorch/Patterns.h | 4 ++-- lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp | 4 ++-- lib/Conversion/TorchOnnxToTorch/DefaultDomainQtoZ.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/torch-mlir/Conversion/TorchOnnxToTorch/Patterns.h b/include/torch-mlir/Conversion/TorchOnnxToTorch/Patterns.h index 1ce381005fcc..b6189b375c5b 100644 --- a/include/torch-mlir/Conversion/TorchOnnxToTorch/Patterns.h +++ b/include/torch-mlir/Conversion/TorchOnnxToTorch/Patterns.h @@ -60,7 +60,7 @@ struct OpBinder { int64_t numOperands) { if (op->getNumOperands() != numOperands) return failure(); - for (int i = 0; i < numOperands; i++) { + for (int64_t i = 0; i < numOperands; i++) { Value curr = op->getOperand(i); if (!toValidTensorType(curr.getType())) { return failure(); @@ -80,7 +80,7 @@ struct OpBinder { } ParseResult tensorOperandsList( llvm::SmallVectorImpl &values) { - for (int i = 0; i < op->getNumOperands(); i++) { + for (uint32_t i = 0; i < op->getNumOperands(); i++) { values.push_back(op->getOperand(i)); } return success(); diff --git a/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp b/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp index fd7013afdb9d..0102366fe01c 100644 --- a/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp +++ b/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp @@ -182,7 +182,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP( return failure(); } Value result = operands[0]; - for (int i = 1; i < operands.size(); i++) { + for (uint64_t i = 1; i < operands.size(); i++) { result = rewriter.create( binder.getLoc(), resultType, result, operands[i]); } @@ -200,7 +200,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP( return failure(); } Value result = operands[0]; - for (int i = 1; i < operands.size(); i++) { + for (uint64_t i = 1; i < operands.size(); i++) { result = rewriter.create( binder.getLoc(), resultType, result, operands[i]); } diff --git a/lib/Conversion/TorchOnnxToTorch/DefaultDomainQtoZ.cpp b/lib/Conversion/TorchOnnxToTorch/DefaultDomainQtoZ.cpp index d88ca9d6d5cb..11a05ea41105 100644 --- a/lib/Conversion/TorchOnnxToTorch/DefaultDomainQtoZ.cpp +++ b/lib/Conversion/TorchOnnxToTorch/DefaultDomainQtoZ.cpp @@ -672,7 +672,7 @@ void mlir::torch::onnx_c::populateDefaultDomainQtoZ( int64_t adjustmentInt = cast(data.getType()).getSizes().size(); // convert axes (tensor) into torch int list while dealing with neg axis - for (int i = 0; i < axes.size(); i++) { + for (uint64_t i = 0; i < axes.size(); i++) { // Go through the axes list and get each dim in the list int64_t dim = axes[i]; if (dim < 0) {