Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining warnings on Windows and turn on warning-as-error #1706

Merged
merged 17 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .azure-pipelines/Windows-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ jobs:
displayName: Download mlir artifact
condition: and(succeeded(), ne(variables['MLIRBuildID'], 'NotFound'))

- script: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd onnx-mlir\third_party\onnx
python setup.py -q install
env:
CMAKE_ARGS: -DCMAKE_PREFIX_PATH="$(Agent.BuildDirectory)\protobuf_install" -DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_MSVC_STATIC_RUNTIME=OFF
displayName: Install onnx
workingDirectory: $(Agent.BuildDirectory)

- script: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call onnx-mlir\utils\build-onnx-mlir.cmd
Expand All @@ -147,15 +156,6 @@ jobs:
env:
CTEST_PARALLEL_LEVEL: ${{ parameters.CTEST_PARALLEL_LEVEL }}

- script: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd onnx-mlir\third_party\onnx
python setup.py -q install
env:
CMAKE_ARGS: -DCMAKE_PREFIX_PATH="$(Agent.BuildDirectory)\protobuf_install" -DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_MSVC_STATIC_RUNTIME=OFF
displayName: Install onnx
workingDirectory: $(Agent.BuildDirectory)

- script: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call onnx-mlir\utils\check-docs.cmd
Expand Down
4 changes: 2 additions & 2 deletions docs/BuildOnWindows.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ call cmake %root_dir%\onnx-mlir -G "Ninja" ^
-DLLVM_EXTERNAL_LIT=%lit_path% ^
-DLLVM_LIT_ARGS=-v ^
-DMLIR_DIR=%root_dir%\llvm-project\build\lib\cmake\mlir ^
-DONNX_MLIR_BUILD_TESTS=ON
-DONNX_MLIR_ENABLE_WERROR=ON

call cmake --build . --config Release --target onnx-mlir
call cmake --build . --config Release
```
After the above commands succeed, an `onnx-mlir` executable should appear in the `Debug/bin` or `Release/bin` directory.

Expand Down
2 changes: 1 addition & 1 deletion docs/doc_check/directive_impl/file_same_as_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def handle(config, ctx):
raise ValueError("Check file-same-as-stdout failed")


ext_to_patterns = {'.dc': 'file-same-as-stdout\\(([^)]*)\\)'}
ext_to_patterns = {'.dc': 'file-same-as-stdout\\((.*)\\)'}
40 changes: 20 additions & 20 deletions src/Transform/ONNX/ConstProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void IterateConstPropElementwiseBinary(char *lhs, char *rhs,
/// Do element-wise binary calculation of 'lhs' and 'rhs' values and create an
/// ONNXConstantOp for the result.
template <typename ElementwiseBinaryOp>
ONNXConstantOp ConstPropElementwiseBinary(
Value ConstPropElementwiseBinary(
PatternRewriter &rewriter, Value replacingValue, Value lhs, Value rhs) {
Type elementType =
replacingValue.getType().cast<ShapedType>().getElementType();
Expand Down Expand Up @@ -383,7 +383,7 @@ ONNXConstantOp ConstPropElementwiseBinary(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -436,7 +436,7 @@ void IterateConstPropElementwiseUnary(
/// Do element-wise unary calculation of 'input' value and create an
/// ONNXConstantOp for the result.
template <typename ElementwiseUnaryOp>
ONNXConstantOp ConstPropElementwiseUnary(
Value ConstPropElementwiseUnary(
PatternRewriter &rewriter, Value replacingValue, Value constValue) {
ShapedType replacingType = replacingValue.getType().cast<ShapedType>();
ArrayRef<int64_t> replacingShape = replacingType.getShape();
Expand Down Expand Up @@ -465,14 +465,14 @@ ONNXConstantOp ConstPropElementwiseUnary(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for transpose.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropTranspose(
Value ConstPropTranspose(
PatternRewriter &rewriter, Value replacingValue, Value constValue) {
ArrayRef<int64_t> replacingShape =
replacingValue.getType().cast<ShapedType>().getShape();
Expand Down Expand Up @@ -504,14 +504,14 @@ ONNXConstantOp ConstPropTranspose(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for unsqueeze.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropUnsqueeze(
Value ConstPropUnsqueeze(
PatternRewriter &rewriter, Value replacingValue, Value input) {
Operation *inputOp = input.getDefiningOp();

Expand All @@ -521,14 +521,14 @@ ONNXConstantOp ConstPropUnsqueeze(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for Squeeze.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropSqueeze(
Value ConstPropSqueeze(
PatternRewriter &rewriter, Value replacingValue, Value input) {
Operation *inputOp = input.getDefiningOp();

Expand All @@ -538,7 +538,7 @@ ONNXConstantOp ConstPropSqueeze(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -761,7 +761,7 @@ class ConstPropScatterNDPattern : public OpRewritePattern<ONNXScatterNDOp> {
// Code to perform constant propagation for CastOp.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropCast(
Value ConstPropCast(
PatternRewriter &rewriter, Value replacingValue, Value constValue) {
// Get the const value using the maximum precision e.g. double, int64_t.
char *constArray =
Expand Down Expand Up @@ -796,14 +796,14 @@ ONNXConstantOp ConstPropCast(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for SliceOp.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropSlice(
Value ConstPropSlice(
PatternRewriter &rewriter, Value replacingValue, Value constValue) {
Operation *op = replacingValue.getDefiningOp();
ONNXSliceOp sliceOp = cast<ONNXSliceOp>(op);
Expand Down Expand Up @@ -852,14 +852,14 @@ ONNXConstantOp ConstPropSlice(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for ConcatOp.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropConcat(PatternRewriter &rewriter, Value replacingValue,
Value ConstPropConcat(PatternRewriter &rewriter, Value replacingValue,
ValueRange operands, IntegerAttr axisAttr) {
// Get the const values using the maximum precision e.g. double, int64_t.
SmallVector<char *, 4> inputArrays;
Expand Down Expand Up @@ -910,14 +910,14 @@ ONNXConstantOp ConstPropConcat(PatternRewriter &rewriter, Value replacingValue,
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for ExpandOp.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropExpand(
Value ConstPropExpand(
PatternRewriter &rewriter, Value replacingValue, Value constValue) {
// Get the const value using the maximum precision e.g. double, int64_t.
char *inputArray =
Expand Down Expand Up @@ -964,14 +964,14 @@ ONNXConstantOp ConstPropExpand(
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
// Code to perform constant propagation for GatherOp.
//===----------------------------------------------------------------------===//

ONNXConstantOp ConstPropGather(PatternRewriter &rewriter, Value replacingValue,
Value ConstPropGather(PatternRewriter &rewriter, Value replacingValue,
Value inputValue, Value indicesValue) {
Operation *op = replacingValue.getDefiningOp();
ONNXGatherOp gatherOp = cast<ONNXGatherOp>(op);
Expand Down Expand Up @@ -1037,7 +1037,7 @@ ONNXConstantOp ConstPropGather(PatternRewriter &rewriter, Value replacingValue,
ONNXConstantOp res =
createConstantOpAndStoreBufferPtr(rewriter, replacingValue, resArray);

return res;
return res.getResult();
}

//===----------------------------------------------------------------------===//
Expand Down
4 changes: 2 additions & 2 deletions test/numerical/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <rapidcheck.h>

#if defined(_MSC_VER)
#ifdef _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS && \
!defined _SILENCE_WAS_PREDEFINED
#if defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) && \
!defined(_SILENCE_WAS_PREDEFINED)
#undef _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#endif
#else
Expand Down
8 changes: 1 addition & 7 deletions test/perf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ add_onnx_mlir_library(PerfLib
PerfHelper.cpp
EXCLUDE_FROM_OM_LIBS

INCLUDE_DIRS PRIVATE
${ONNX_MLIR_SRC_ROOT}/third_party/benchmark/include
${ONNX_MLIR_BIN_ROOT}/third_party/benchmark/include

LINK_LIBS PUBLIC
benchmark
CompilerUtils
LLVMSupport
)

add_custom_target(perf)
Expand Down Expand Up @@ -48,8 +44,6 @@ function(add_perf_unittest test_name)
set_tests_properties(${test_name} PROPERTIES LABELS perf)
endfunction()

# The CompilerUtils ExecutionSession are also included in ModelLib,
# but it did not compile when I removed these two. TODO, figure out why.
set(TEST_LINK_LIBS ModelLib PerfLib)

add_perf_unittest(PerfGemm
Expand Down
4 changes: 2 additions & 2 deletions utils/build-onnx-mlir.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ call cmake %root_dir%\onnx-mlir -G "Ninja" ^
-DLLVM_EXTERNAL_LIT=%lit_path% ^
-DLLVM_LIT_ARGS=-v ^
-DMLIR_DIR=%root_dir%\llvm-project\build\lib\cmake\mlir ^
-DONNX_MLIR_BUILD_TESTS=ON
-DONNX_MLIR_ENABLE_WERROR=ON

call cmake --build . --config Release --target onnx-mlir
call cmake --build . --config Release