intel / intel/torch-xpu-ops

[Win][Build] There is Cyclic dependencies error when build with BUILD_SEPARATE_OPS=true

Open
#3,209 1 comment 0 reactions 1 assignee Claimed by @copilot-swe-agent View on GitHub
module: build os: Windows
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 13h
Merged PRs (30d)
107

Description

### 🐛 Describe the bug

When build PyTorch on windows, there two modes: BUILD_SEPARATE_OPS or not.
In release build case, BUILD_SEPARATE_OPS is false. It's passed in building on windows.
But when set BUILD_SEPARATE_OPS=true or CMAKE_BUILD_TYPE is "Debug", the build mode BUILD_SEPARATE_OPS will lead to error:
```
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"torch_xpu" of type SHARED_LIBRARY
depends on "torch_xpu_ops" (weak)
"torch_xpu_ops" of type STATIC_LIBRARY
depends on "torch_xpu" (weak)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed. Build files cannot be regenerated correctly.
```

Reproduce:
Apply following diff in torch_xpu_ops, and build again.
```
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f6fa8d6..033a47d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,6 +96,7 @@ endif()

# Only for debugging. Save building time by shrinking translation unit scope.
set(BUILD_SEPARATE_OPS $ENV{BUILD_SEPARATE_OPS})
+set(BUILD_SEPARATE_OPS TRUE)
if(CMAKE_BUILD_TYPE MATCHES "(Debug|RelWithDebInfo)")
set(BUILD_SEPARATE_OPS TRUE)
endif()
```

### Versions

https://github.com/intel/torch-xpu-ops

commit 1c25bb5ddf4f5cfcf84d2614864c9ca5d445426a (HEAD, main)
Author: Piotr Bielak
Date: Thu Mar 26 20:09:23 2026 +0100

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.