-
Notifications
You must be signed in to change notification settings - Fork 686
[Windows] Run native unit tests in CI #13923
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
GregoryComer
merged 3 commits into
pytorch:main
from
GregoryComer:windows-native-test-ci
Sep 11, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
param ( | ||
[string]$editable = $false | ||
[string]$editable = "false" | ||
) | ||
|
||
conda create --yes --quiet -n et python=3.12 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
param ( | ||
[string]$editable = $false | ||
[string]$buildMode = "Release" | ||
) | ||
|
||
Set-PSDebug -Trace 1 | ||
$ErrorActionPreference = 'Stop' | ||
$PSNativeCommandUseErrorActionPreference = $true | ||
|
||
# Run pytest with coverage | ||
# pytest -n auto --cov=./ --cov-report=xml | ||
pytest -v --full-trace -c pytest-windows.ini | ||
# Run native unit tests (via ctest) | ||
New-Item -Path "test-build" -ItemType Directory | ||
cd "test-build" | ||
|
||
cmake .. --preset windows -B . -DEXECUTORCH_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$buildMode | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE." | ||
Write-Host "CMake configuration was unsuccessful. Exit code: $LASTEXITCODE." | ||
exit $LASTEXITCODE | ||
} | ||
|
||
cmake --build . -j8 --config $buildMode --verbose | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "CMake build was unsuccessful. Exit code: $LASTEXITCODE." | ||
exit $LASTEXITCODE | ||
} | ||
|
||
ctest -j8 . --build-config $buildMode --output-on-failure -E "method_test|tensor_parser_test" | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "CTest run was unsuccessful. Exit code: $LASTEXITCODE." | ||
exit $LASTEXITCODE | ||
} | ||
|
||
cd .. | ||
|
||
# Run pytest | ||
pytest -v -c pytest-windows.ini | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE." | ||
exit $LASTEXITCODE | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,21 +49,21 @@ Tensor& argmax_out( | |
static constexpr const char op_name[] = "argmax.out"; | ||
|
||
ET_SWITCH_REALHBF16_TYPES(in.scalar_type(), ctx, op_name, CTYPE, [&] { | ||
long* out_data = out.mutable_data_ptr<long>(); | ||
int64_t* out_data = out.mutable_data_ptr<int64_t>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. We should have a lint for this cc @manuelcandales |
||
|
||
const bool success = parallel_for_each_reduce_over_dim_output_index( | ||
in, dim, out, [&](const auto begin, const auto end) { | ||
for (const auto out_ix : c10::irange(begin, end)) { | ||
std::tuple<CTYPE, long> acc = reduce_over_dim<CTYPE>( | ||
[](CTYPE v, long ix, CTYPE acc_val, long acc_ix) { | ||
std::tuple<CTYPE, int64_t> acc = reduce_over_dim<CTYPE>( | ||
[](CTYPE v, int64_t ix, CTYPE acc_val, int64_t acc_ix) { | ||
// the below condition as written is equivalent to | ||
// !isnan(accval) && (isnan(v) || v > acc_val). See | ||
// argument in op_argmin.cpp. | ||
if (!utils::isnan_override(acc_val) && !(v <= acc_val)) { | ||
acc_val = v; | ||
acc_ix = ix; | ||
} | ||
return std::tuple<CTYPE, long>{acc_val, acc_ix}; | ||
return std::tuple<CTYPE, int64_t>{acc_val, acc_ix}; | ||
}, | ||
in, | ||
dim, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like evidence that we shouldnt have a mono recipe test with real backends.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, might make sense to refactor it as a follow up. CC @abhinaykukkadapu Do you have any preferences on handling of platform-specific recipes?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that lowering works across all platforms, although i haven't thought about windows tbf.
these tests only call forward if those specific et backends are available, check here: https://github.com/pytorch/executorch/blob/main/export/tests/test_target_recipes.py#L103, otherwise these tests just lowers the model.
@metascroy do you know if coreml tools work on a windows platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. From what I read, coremltools AOT flow is not available on Windows.