Skip to content

[xpupti] Fix Windows build support for xpupti tests and multi-config generators. - #1394

Merged
ryanzhang22 merged 18 commits into
pytorch:mainfrom
intel-staging:dev/tsocha/oneccl-1
Jul 29, 2026
Merged

[xpupti] Fix Windows build support for xpupti tests and multi-config generators.#1394
ryanzhang22 merged 18 commits into
pytorch:mainfrom
intel-staging:dev/tsocha/oneccl-1

Conversation

@tsocha

@tsocha tsocha commented May 11, 2026

Copy link
Copy Markdown
Contributor

It's a part of #1335 1/3

  • Refactor test/xpupti/CMakeLists.txt to handle Windows and multi-config generators (VS, Ninja Multi-Config):

    • Force Ninja as the inner ExternalProject generator on Windows and propagate $ via CONFIGURE_COMMAND for multi-config
    • Use WINDOWS_EXPORT_ALL_SYMBOLS and /FORCE:UNRESOLVED so the shared test library can build against ComputeOnXpu defined in the compute executable
    • Pass LINK_LIBRARY_NAME/LINK_LIBRARY_DIR instead of a hardcoded lib.so path; inner project resolves via find_library with config-aware PATH_SUFFIXES
    • Forward SYCL lib path to the inner linker on Windows
    • Skip -Wl,--export-dynamic on Windows in compute/CMakeLists.txt
  • Rename make_test to make_sycl_test to reflect SYCL-based tests.

  • Fix XPUPTI_BUILD_FLAG so -DHAS_XPUPTI is visible in both the current and parent scopes (was only set in PARENT_SCOPE).

  • Reorder id/linked/metadata assignments in XpuptiActivityProfilerSession::handleRuntimeKernelMemcpyMemsetActivities and inline the linkedActivity lookup — no behavior change.

  • Include src/ActivityBuffers.h in XpuptiTestUtilities.cpp and hoist iterator declarations out of the for-init to satisfy MSVC.

* Refactor test/xpupti/CMakeLists.txt to handle Windows and
  multi-config generators (VS, Ninja Multi-Config):
  - Force Ninja as the inner ExternalProject generator on Windows
    and propagate $<CONFIG> via CONFIGURE_COMMAND for multi-config
  - Use WINDOWS_EXPORT_ALL_SYMBOLS and /FORCE:UNRESOLVED so the
    shared test library can build against ComputeOnXpu defined in
    the compute executable
  - Pass LINK_LIBRARY_NAME/LINK_LIBRARY_DIR instead of a hardcoded
    lib<name>.so path; inner project resolves via find_library with
    config-aware PATH_SUFFIXES
  - Forward SYCL lib path to the inner linker on Windows
  - Skip -Wl,--export-dynamic on Windows in compute/CMakeLists.txt

* Add XpuptiActivityHandlersTest executable (unit test that does
  not require the SYCL compute ExternalProject); rename make_test
  to make_sycl_test to reflect the remaining SYCL-based tests.

* Fix XPUPTI_BUILD_FLAG so -DHAS_XPUPTI is visible in both the
  current and parent scopes (was only set in PARENT_SCOPE).

* Reorder id/linked/metadata assignments in
  XpuptiActivityProfilerSession::handleRuntimeKernelMemcpyMemsetActivities
  and inline the linkedActivity lookup — no behavior change.

* Include src/ActivityBuffers.h in XpuptiTestUtilities.cpp and
  hoist iterator declarations out of the for-init to satisfy MSVC.
@meta-cla meta-cla Bot added the cla signed label May 11, 2026
@tsocha

tsocha commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

@gujinghui please review it.

@gujinghui

Copy link
Copy Markdown

@tsocha
can we merge the changes of #1337 into this PR?

xpupti files including into compilation is handled in cmakefiles
@tsocha

tsocha commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@gujinghui

@tsocha can we merge the changes of #1337 into this PR?

DONE

Comment thread libkineto/src/plugin/xpupti/CMakeLists.txt
@gujinghui

Copy link
Copy Markdown

@divyanshk @scotts This PR is ready for your review. Thanks.

@tsocha tsocha changed the title Fix Windows build support for xpupti tests and [xpupti] Fix Windows build support for xpupti tests and Jun 24, 2026
@tsocha tsocha changed the title [xpupti] Fix Windows build support for xpupti tests and [xpupti] Fix Windows build support for xpupti tests and multi-config generators. Jun 25, 2026
@ZhaoqiongZ ZhaoqiongZ moved this to Aged Pending Review in PyTorch Intel Jul 6, 2026
@gujinghui

Copy link
Copy Markdown

@ryanzhang22 @scotts
This PR is ready for your review. Thanks.

@meta-codesync

meta-codesync Bot commented Jul 13, 2026

Copy link
Copy Markdown

@ryanzhang22 has imported this pull request. If you are a Meta employee, you can view this in D111713633.

Comment thread libkineto/test/xpupti/CMakeLists.txt Outdated
POSITION_INDEPENDENT_CODE ON
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
# On Windows, DLLs must resolve all symbols at link time (unlike Linux .so).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for my understanding: I see that the build is forced to progress despite the error with this flag enabled, but how does this end up producing a valid binary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is caused by circular dependency.
The library is compiled with a missing symbol and during program loading this symbol is provided by the test .exe file, as it exports all of its symbols.

@pytorch-bot

pytorch-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@tsocha

tsocha commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@ryanzhang22 I have included a change from @aostrowski-hbn

Circular dependency has been resolved and CMake is cleaner now.

@gujinghui

Copy link
Copy Markdown

@ryanzhang22 The issue has been addressed. Could you please review the PR? Thanks.

@ryanzhang22

Copy link
Copy Markdown
Contributor

Taking a look

@ryanzhang22

Copy link
Copy Markdown
Contributor

Do you know if the XPU CI failure is related?

@tsocha

tsocha commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@ryanzhang22

Do you know if the XPU CI failure is related?

I don't think it's related to my change.
I have this error if ZET_ENABLE_METRICS=1 env variable is missing.

@ryanzhang22
ryanzhang22 merged commit 9e826ca into pytorch:main Jul 29, 2026
12 of 13 checks passed
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jul 30, 2026
Includes the following commits:

- Clean up dtypes for metadata fields (pytorch/kineto#1499) 6f446fe
- [xpupti] Fix Windows build support for xpupti tests and multi-config generators. (pytorch/kineto#1394) 9e826ca
- Test ConfigLoader on-demand daemon poll ingress (pytorch/kineto#1504) 7674d28
- Remove comment about documentation (pytorch/kineto#1503) eeb3db9
- Remove HTA from README (pytorch/kineto#1502) 46b1c63
- Catch config-update exceptions so the poll thread can't crash the process (pytorch/kineto#1498) be334e1
- Drop EventProfiler config kind from ConfigLoader (pytorch/kineto#1496) e7c97a6
- Remove event-only config surface from Config (pytorch/kineto#1495) a3a0566
- Remove dead event profiler: runtime, CUPTI backends, build wiring (pytorch/kineto#1494) 36c2e05
- Decompose libkineto_defs.bzl source lists into atoms (pytorch/kineto#1493) 328fa51
- Add XPU synchronization events to XPUPTI profiler (pytorch/kineto#1395) 8285e5b
- Re-enable CI linting and lint all C++ (pytorch/kineto#1489) 2c41c01
- Test ConfigLoader handler fan-out (pytorch/kineto#1487) cccc5d1
- Update C++ lint tooling (pytorch/kineto#1488) 57e59e6
Pull Request resolved: #191526
Approved by: https://github.com/scotts
@tsocha
tsocha deleted the dev/tsocha/oneccl-1 branch July 30, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Aged Pending Review

Development

Successfully merging this pull request may close these issues.

5 participants