Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Introducing a way to builder kernels for Windows platforms#250

Merged
danieldk merged 38 commits into
mainfrom
build-driver-win
Oct 16, 2025
Merged

Introducing a way to builder kernels for Windows platforms#250
danieldk merged 38 commits into
mainfrom
build-driver-win

Conversation

@mfuntowicz
Copy link
Copy Markdown
Member

This PR attempts to replicate what is being done with NixOS on Windows platform through a PowerShell scripts kbuild.ps1.

It leverages build2cmake as much as possible and attempts to move some parts currently handle in Nix directly in CMake to avoid dupplication as much as possible (when feasible).

It also introduce two CMake functions to automatically generate the layout required by kernels::get_local_kernel and hub based build, so it easy to debug and publish.

@mfuntowicz
Copy link
Copy Markdown
Member Author

mfuntowicz commented Oct 9, 2025

Example invocation :

Local build with kernels::get_local_kernel compatible layout

kbuilder.ps1 -SourceFolder ./examples/activation -BuildConfig Release -Backend cuda -ArchList 8.9 -Build -LocalInstall -InstallPrefix .\examples\activation\build -Force

Local build with kernels remote layout (hub)

kbuilder.ps1 -SourceFolder ./examples/activation -BuildConfig Release -Backend cuda -ArchList 8.9 -Build -KernelsInstall -InstallPrefix .\examples\activation\build -Force

Copy link
Copy Markdown
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Great work!

I would like to keep all CMake extensions Windows-only for the reasons outlined in the comments.

Except changes like this of course:

if(NOT MSVC)
    target_link_options({{ ops_name }} PRIVATE -static-libstdc++)
endif()

Comment thread .github/workflows/build_kernel_windows.yaml
Comment thread .github/workflows/build_kernel_windows.yaml.yml Outdated
Comment thread scripts/windows/builder.ps1
Comment thread build-driver/kbuilder.ps1 Outdated
Write-Status "Configuring CMake project..." -Type Info
Push-Location $buildDir
try {
$configureArgs = @("..", "-G", "Visual Studio 17 2022", "-A", "x64")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this the same version Python and PyTorch are compiled with? (Not sure how ABI compat works on Windows)

Comment thread build2cmake/src/templates/utils.cmake Outdated
Comment thread build2cmake/src/templates/cuda/preamble.cmake
@mfuntowicz mfuntowicz marked this pull request as ready for review October 16, 2025 14:33
@danieldk
Copy link
Copy Markdown
Member

Really nice to have this, looks great!

@danieldk danieldk merged commit 73476d3 into main Oct 16, 2025
30 checks passed
@danieldk danieldk deleted the build-driver-win branch October 16, 2025 18:07
@danieldk danieldk mentioned this pull request Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants