torch-mlir/build_tools
Ashay Rane 28bb866260
CI: prepare CI for ccache updates for MSVC/Windows (#2120)
This patch, by itself, doesn't fix caching on Windows, but once a new
release of ccache is available, caching for Windows builds should start
working again (validated by building ccache from source and using it
with LLVM builds).

Ccache rejects caching when either the `/Zi` or `/ZI` flags are used
during compilation on Windows, since these flags tell the compiler to
embed debug information in a PDB file (separate from the object file
produced by the compiler).  In particular, our CI builds add the `/Zi`
flag, making ccache mark these compiler invocations as uncacheable.

But what caused our CI to add debug flags, especially when we specified
`-DCMAKE_BUILD_TYPE=Release`?  On Windows, unless we specify the
`--config Release` flag during the CMake build step, CMake assumes a
debug build.  So all this while, we had been producing debug builds of
torch-mlir for every PR!  No doubt it took so long to build the Windows
binaries.

The reason for having to specify the configuration during the _build_
step (as opposed to the _configure_ step) of CMake on Windows is that
CMake's Visual Studio generators will produce _both_ Release and Debug
profiles during the CMake configure step (thus requiring a build-time
value that tells CMake whether to build in Release or Debug mode).
Luckily, on Linux and macOS, the `--config` flag seems to be simply
ignored, instead of causing build errors.

Strangely, based on cursory tests, it seems like on Windows we need to
specify the Relase configuration as both `-DCMAKE_BUILD_TYPE=Release` as
well as `--config Release`.  Dropping either made my build switch to a
Debug configuration.

Additionally, there is a bug in ccache v4.8 (although this is addressed
in trunk) that causes ccache to reject caching if the compiler
invocation includes any flag that starts with `/Z`, including /`Zc`,
which is added by LLVM's HandleLLVMOptions.cmake and which isn't related
to debug info or PDB files.  The next release of ccache should include
the fix, which is to reject caching only for `/Zi` and `/ZI` flags and
not all flags that start with `/Z`.

As a side note, debugging this problem was possible because of ccache's
log file, which is enabled by: `ccache --set-config="log_file=log.txt"`.
2023-05-12 12:45:01 -05:00
..
docker Dockerize CI + Release builds (#1234) 2022-08-30 11:07:25 -07:00
python_deploy CI: prepare CI for ccache updates for MSVC/Windows (#2120) 2023-05-12 12:45:01 -05:00
autogen_ltc_backend.py Fix OptionalCType class name (#1779) 2023-01-06 17:03:24 -05:00
autogen_ltc_backend.yaml Remove all but one of valsem ops + move fill.Scalar to elementwise (#1531) 2022-10-28 15:06:11 +00:00
build_libtorch.sh build: make PyTorch caching more robust (#1510) 2022-10-20 08:50:18 -05:00
build_python_wheels.sh build: improve robustness of cmake and shell scripts (#1018) 2022-07-06 14:39:30 -07:00
build_standalone.sh build: improve robustness of cmake and shell scripts (#1018) 2022-07-06 14:39:30 -07:00
scrape_releases.py Create github action for creating pip-compatible releases index 2022-09-23 15:26:19 -04:00
update_abstract_interp_lib.sh [custom op] Generalize shape library logic to work with dtypes (#1594) 2022-12-13 08:25:41 -08:00
update_torch_ods.sh build: enable update scripts to work with out-of-tree builds (#1553) 2022-11-04 08:13:02 -05:00
write_env_file.sh build: improve robustness of cmake and shell scripts (#1018) 2022-07-06 14:39:30 -07:00