DZRobo
commited on
Commit
·
7533dde
1
Parent(s):
cdc8e19
Set MSVC build tool env vars for Windows builds
Browse filesAdds environment variables DISTUTILS_USE_SDK and MSSdk when running on Windows to ensure distutils reuses existing MSVC build tools. This helps with compiler detection in plain shells and improves reliability of source builds.
scripts/check_sageattention.ps1
CHANGED
|
@@ -266,6 +266,12 @@ if(-not $wantSA3 -and -not $wheelOk){
|
|
| 266 |
$arch = ''
|
| 267 |
if($ti.is_cuda -and $ti.cc){ $arch = $ti.cc }
|
| 268 |
if($arch){ $env:TORCH_CUDA_ARCH_LIST = $arch }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
# Ensure toolchain
|
| 270 |
Write-Section "Toolchain check"
|
| 271 |
$hasCL = ($null -ne (Get-Command cl.exe -ErrorAction SilentlyContinue))
|
|
@@ -307,6 +313,11 @@ if($wantSA3 -and -not $sa3present){
|
|
| 307 |
if(-not $wheelOk){
|
| 308 |
Write-Section "Building SA2 from source"
|
| 309 |
$null = Invoke-Quiet $py.path "-m pip install -U packaging cmake ninja" "toolchain python deps"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
$built = $false
|
| 311 |
$urls = @(
|
| 312 |
'https://github.com/thu-ml/SageAttention/archive/refs/heads/main.zip',
|
|
|
|
| 266 |
$arch = ''
|
| 267 |
if($ti.is_cuda -and $ti.cc){ $arch = $ti.cc }
|
| 268 |
if($arch){ $env:TORCH_CUDA_ARCH_LIST = $arch }
|
| 269 |
+
# On Windows, hint distutils to reuse existing SDK (helps cl detection in plain shells)
|
| 270 |
+
if($isWindows){
|
| 271 |
+
$env:DISTUTILS_USE_SDK = "1"
|
| 272 |
+
$env:MSSdk = "1"
|
| 273 |
+
Write-Host "Using existing MSVC build tools (DISTUTILS_USE_SDK=1, MSSdk=1)" -ForegroundColor DarkCyan
|
| 274 |
+
}
|
| 275 |
# Ensure toolchain
|
| 276 |
Write-Section "Toolchain check"
|
| 277 |
$hasCL = ($null -ne (Get-Command cl.exe -ErrorAction SilentlyContinue))
|
|
|
|
| 313 |
if(-not $wheelOk){
|
| 314 |
Write-Section "Building SA2 from source"
|
| 315 |
$null = Invoke-Quiet $py.path "-m pip install -U packaging cmake ninja" "toolchain python deps"
|
| 316 |
+
if($isWindows){
|
| 317 |
+
$env:DISTUTILS_USE_SDK = "1"
|
| 318 |
+
$env:MSSdk = "1"
|
| 319 |
+
Write-Host "Using existing MSVC build tools (DISTUTILS_USE_SDK=1, MSSdk=1)" -ForegroundColor DarkCyan
|
| 320 |
+
}
|
| 321 |
$built = $false
|
| 322 |
$urls = @(
|
| 323 |
'https://github.com/thu-ml/SageAttention/archive/refs/heads/main.zip',
|