Skip to content

Fix output directory on Windows with non-VS generators #924

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

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

kbenzie
Copy link
Contributor

@kbenzie kbenzie commented Nov 21, 2024

Description

On Windows when configuring CMake with the Ninja generator and -DUMF_BUILD_SHARED_LIBRARY=ON the umf.dll is output to the ${CMAKE_BINARY_DIR}/bin/$<CONFIG> directory, this is problematic as it breaks tools like urinfo.exe and sycl-ls.exe in development builds as they rely on umf.dll residing in the same
directory in order to be loaded.

This behavior is desirable when using Visual Studio generators, however. Therefore, this patch changes the logic to check if CMAKE_GENERATOR matches the "Visual Studio" string before appending $<CONFIG> to the output directory.

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@kbenzie kbenzie changed the title Fix output direcctory on Windows with non-VS generators Fix output directory on Windows with non-VS generators Nov 21, 2024
@kbenzie kbenzie force-pushed the benie/windows-fix-output-dir branch from 3b1ef5f to 7fd639c Compare November 21, 2024 14:37
set(CUSTOM_COMMAND_BINARY_DIR ${CMAKE_UMF_OUTPUT_DIRECTORY})
if(MSVC)
# MSVC implicitly adds $<CONFIG> to the output path
set(CUSTOM_COMMAND_BINARY_DIR ${CUSTOM_COMMAND_BINARY_DIR}/$<CONFIG>)
Copy link
Contributor Author

@kbenzie kbenzie Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this variable since it does not appear to be getting used anywhere, it's also adding $<CONFIG> when it's already be added which seems wrong.

Happy to reinstate if it is being used somewhere I missed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall using CUSTOM_COMMAND_BINARY_DIR anywhere explicitly

@kbenzie kbenzie marked this pull request as ready for review November 21, 2024 15:46
@kbenzie kbenzie requested a review from a team as a code owner November 21, 2024 15:46
Copy link
Contributor

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatKamin, pehaps we should verify (locally?) our internal sycl-test - it uses Ninja generator...? we would confirm it's not breaking the internal testing...

LGTM 👍

set(CUSTOM_COMMAND_BINARY_DIR ${CMAKE_UMF_OUTPUT_DIRECTORY})
if(MSVC)
# MSVC implicitly adds $<CONFIG> to the output path
set(CUSTOM_COMMAND_BINARY_DIR ${CUSTOM_COMMAND_BINARY_DIR}/$<CONFIG>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall using CUSTOM_COMMAND_BINARY_DIR anywhere explicitly

@PatKamin
Copy link
Contributor

@PatKamin, pehaps we should verify (locally?) our internal sycl-test - it uses Ninja generator...? we would confirm it's not breaking the internal testing...

LGTM 👍

This test does not involve building UMF from sources, so this change shouldn't affect sycl-test.

@kbenzie kbenzie force-pushed the benie/windows-fix-output-dir branch from 7fd639c to ced8f13 Compare November 22, 2024 11:48
On Windows when configuring CMake with the Ninja generator and
`-DUMF_BUILD_SHARED_LIBRARY=ON` the `umf.dll` is output to the
`${CMAKE_BINARY_DIR}/bin/$<CONFIG>` directory, this is
problematic as it breaks tools like `urinfo.exe` and `sycl-ls.exe` in
development builds as they rely on `umf.dll` residing in the same
directory in order to be loaded.

This behavior is desirable when using Visual Studio generators, however.
Therefore, this patch changes the logic to check if `CMAKE_GENERATOR`
matches the `"Visual Studio"` string before appending `$<CONFIG>` to the
output directory.
@kbenzie kbenzie force-pushed the benie/windows-fix-output-dir branch from ced8f13 to 8d81df9 Compare November 22, 2024 11:55
@kbenzie
Copy link
Contributor Author

kbenzie commented Nov 22, 2024

  'pwsh.exe' is not recognized as an internal or external command,
  operable program or batch file.

Problem with the runner?

@lukaszstolarczuk
Copy link
Contributor

  'pwsh.exe' is not recognized as an internal or external command,
  operable program or batch file.

Problem with the runner?

yeah, don't you worry about this one; re-run should fix it

@bratpiorka
Copy link
Contributor

@kbenzie thanks!

@bratpiorka bratpiorka merged commit 61f02ef into oneapi-src:main Nov 22, 2024
78 checks passed
@kbenzie
Copy link
Contributor Author

kbenzie commented Nov 22, 2024

How should we get these changes into UR then intel/llvm? Ideally this would be in time to merge to intel/llvm in time for pulldown on Tuesday.

I tried using UMF main branch tag in UR locally but am getting errors like this:

P:\oneapi-src\unified-runtime\source\common\umf_pools/disjoint_pool_config_parser.hpp(26): error C2079: 'usm::DisjointPoolAllConfigs::Configs' uses undefined struct 'umf_disjoint_pool_params_t'

@lukaszstolarczuk
Copy link
Contributor

How should we get these changes into UR then intel/llvm? Ideally this would be in time to merge to intel/llvm in time for pulldown on Tuesday.

I tried using UMF main branch tag in UR locally but am getting errors like this:

P:\oneapi-src\unified-runtime\source\common\umf_pools/disjoint_pool_config_parser.hpp(26): error C2079: 'usm::DisjointPoolAllConfigs::Configs' uses undefined struct 'umf_disjoint_pool_params_t'

We've introduced on main first bunch of changes around our configs; the error you see after bumping UMF is related to: #901

We planned to update UMF in UR when all changes related to configs are merged (at least PRs with label v0.10.x).

When you said Tuesday - did you mean this one, a.k.a. tomorrow?

@kbenzie
Copy link
Contributor Author

kbenzie commented Nov 25, 2024

When you said Tuesday - did you mean this one, a.k.a. tomorrow?

That's when the pulldown is scheduled for, yeah. If it's not possible by then it can be cherry-picked. As long as its included in the next release.

@lukaszstolarczuk
Copy link
Contributor

Ok, we were aiming for the next pulldown with all these changes, but no worries, we decided to prepare a special branch with a couple of cherry-picks for UR - I'll make a PR for UR in just a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants