Skip to content

Commit

Permalink
Fix remaining issues on Windows and turn on warning as error on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Stella Stamenova <[email protected]>
  • Loading branch information
sstamenova committed Sep 19, 2022
1 parent 7661a56 commit 8dd7b99
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
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
2 changes: 1 addition & 1 deletion docs/BuildOnWindows.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ call cmake %root_dir%\onnx-mlir -G "Ninja" ^
-DLLVM_LIT_ARGS=-v ^
-DMLIR_DIR=%root_dir%\llvm-project\build\lib\cmake\mlir

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\\((.*)\\)'}
20 changes: 20 additions & 0 deletions src/Transform/ONNX/ConstProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,27 @@ ONNXConstantOp ConstPropGather(PatternRewriter &rewriter, Value replacingValue,
// Pattern definition.
//===----------------------------------------------------------------------===//

// Several lines in the generated file produce warning C4927 when compiled with
// the MSVC compiler. For example: ONNXConstProp.inc(766):
//
// auto nativeVar_0 = ConstPropElementwiseBinary<mlir::ONNXAddOp>(rewriter,
// (*addOp.getODSResults(0).begin()), (*lhs.getODSResults(0).begin()),
// (*rhs.getODSResults(0).begin())); (void)nativeVar_0;
//
// for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ {nativeVar_0} }) {
// tblgen_repl_values.push_back(v);
// }
//
// This is due to the definition of ConstPropElementwiseBinary (and others) and
// needs to be addressed with a comprehensive change to ConstProp.td

#if defined(_MSC_VER)
#pragma warning(disable : 4927)
#endif
#include "src/Transform/ONNX/ONNXConstProp.inc"
#if defined(_MSC_VER)
#pragma warning(default : 4927)
#endif

//===----------------------------------------------------------------------===//
// Code to manage the pass.
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
2 changes: 1 addition & 1 deletion utils/build-onnx-mlir.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ call cmake %root_dir%\onnx-mlir -G "Ninja" ^
-DLLVM_LIT_ARGS=-v ^
-DMLIR_DIR=%root_dir%\llvm-project\build\lib\cmake\mlir

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

0 comments on commit 8dd7b99

Please sign in to comment.