llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[SYCL][UR][CMake] Stop creating debug library builds on Windows during release builds

Open steffenlarsen opened this issue 8 months ago • 3 comments

Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is. This PR changes the build to only build in the mode specified by the CMAKE_BUILD_TYPE, meaning that packaging of release builds must build both explicitly and copy the files into the packages.

To allow parity with old builds, the -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL can be used during configuration to use the debug UCRT in release mode, generating "d"-suffixed libraries. This can also be controlled in the configure.py script using the --use-debug-crt-dll option.

Additionally, this PR adds a new test that checks that library files in build mode all have the required postfix ("d" or "d-preview") when they link with Windows debug URCT, and the release variant if not.

steffenlarsen avatar Apr 25 '25 15:04 steffenlarsen

I believe we are ready to consider this, so I've moved it to ready-for-review.

steffenlarsen avatar May 06 '25 06:05 steffenlarsen

I don't think that

Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is.

is accurate. IMO, it's more like 4 configurations:

  1. release build with release C/C++ runtime
  2. debug build with debug C/C++ runtime
  3. Optimized/possibly stripped "release-like" build with debug C/C++ runtime (and /MDd would imply -D_DEBUG and -UNDEBUG, but whatever).
  4. non-optimized/non-stripped "debug-like" without MSVC's _DEBUG and linked with C/C++ runtime (most useless one).

I think before this we could ship 1 and 3, but after this I'm afraid we'd have to ship 1 and 2 and I'm really not sure if we want this. Am I missing anything?

aelovikov-intel avatar May 16 '25 17:05 aelovikov-intel

I don't think that

Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is.

is accurate. IMO, it's more like 4 configurations:

  1. release build with release C/C++ runtime
  2. debug build with debug C/C++ runtime
  3. Optimized/possibly stripped "release-like" build with debug C/C++ runtime (and /MDd would imply -D_DEBUG and -UNDEBUG, but whatever).
  4. non-optimized/non-stripped "debug-like" without MSVC's _DEBUG and linked with C/C++ runtime (most useless one).

I think before this we could ship 1 and 3, but after this I'm afraid we'd have to ship 1 and 2 and I'm really not sure if we want this. Am I missing anything?

Correct. The configurations are not exactly 1:1. I believe our current d-suffixed approach doesn't follow the rest of the libraries out there. That said, release builds can enable optimizations on top of debug mode. Maybe we should include RelWithDebugInfo as enabling /MDd too?

Alternatively, I can add an option that enables debug UCRT for the current build, which releases can use.

steffenlarsen avatar May 19 '25 04:05 steffenlarsen