8000 [libtorch] Debug and Release should be shipped together on Windows · Issue #155667 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
8000
Skip to content
[libtorch] Debug and Release should be shipped together on Windows #155667
Open
@miriameng

Description

@miriameng

🚀 The feature, motivation and pitch

Currently on Windows the Release version (https://download.pytorch.org/libtorch/cu128/libtorch-win-shared-with-deps-2.7.1%2Bcu128.zip) and Debug version (https://download.pytorch.org/libtorch/cu128/libtorch-win-shared-with-deps-debug-2.7.1%2Bcu128.zip) are shipped separately, and there's no easy way to switch between Debug/Release, in cmake we have to set Torch_DIR to point to either release or debug, and it's not possible to use any if else to make it work because for multi config generator like Visual Studio, whether to compile in release or debug is a build time decision instead of a cmake config time decision, yet we have to decide which libtorch to point to during cmake config time with the current setup, which means if we decided that we want to switch from release to debug, we will have to clear the build folder, adjust Torch_DIR, redo cmake, and rebuild in order to switch, which is really cumbersome.

Ideally on Windows the Release version and Debug version should be shipped together, and then make use of IMPORTED_LOCATION_DEBUG to point to the debug dlls and IMPORTED_LOCATION_RELEASE to point to the release dlls. Instead of just IMPORTED_LOCATION like we currently have in https://github.com/pytorch/pytorch/blob/main/cmake/TorchConfig.cmake.in#L159. Libraries installed by vcpkg (https://github.com/microsoft/vcpkg/) have this and when compiling our own application it automatically points to the debug dlls in debug mode and release dlls in release mode, and everything just works. For example, vcpkg install glm, and then investigate the generated glmConfig we will see something like

set_target_properties(glm::glm PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/glm.lib"
  )

and

set_target_properties(glm::glm PROPERTIES
  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/debug/lib/glm.lib"
  )

Alternatives

No response

Additional context

No response

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: windowsWindows support for PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0