Report Windows COFF archive output failures - #9440
Merged
mcourteaux merged 1 commit intoSep 13, 2026
Merged
Conversation
This was referenced Sep 10, 2026
alexreinking
approved these changes
Sep 10, 2026
Contributor
Author
|
@alexreinking, sorry these were committed with [skip ci] - I made a dummy commit to trigger workflows. Please approve! Needless to say this should be a squash merge |
Member
|
@gregcotten — could you please rebase on |
Reject archive open/write failures before generation can report success or publish stale output to the generator cache. Flush before archive seeks so buffered write failures remain visible in the output stream state. Extend the existing compile-to and cache correctness tests with failed opening, failure after opening, cache publication, and recovery coverage. Run exception-based checks only when Halide supports exceptions. Fixes halide#9439 Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
gregcotten
force-pushed
the
fix-coff-archive-output-errors
branch
from
September 11, 2026 15:17
4a5f844 to
01d866e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9440 +/- ##
==========================================
+ Coverage 69.95% 70.12% +0.17%
==========================================
Files 261 261
Lines 79596 79604 +8
Branches 19400 19402 +2
==========================================
+ Hits 55678 55825 +147
+ Misses 18004 17980 -24
+ Partials 5914 5799 -115 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@alexreinking done! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #9439. Related: #9438.
Direct COFF archive generation can return success after failing to write its destination. An old readable
.libmay then be cached under the requested pipeline's key. This also reproduces with the generator cache disabled.Check archive opening and final stream state, and flush explicitly before the writer's seeks so a buffered write failure is recorded before seeking. A Windows byte-range-lock regression demonstrates why checking only opening and final state is insufficient on the tested MSVC implementation. Failed writes now stop compilation before cache publication; successful archives remain byte-identical and the fix adds no archive-sized buffer.
The change adds eight executable lines and a two-line comment in the COFF writer, plus regressions in the existing
compile_toandgenerator_cachetests. They cover blocked opening, failure after opening, recovery, absence of a cache entry after failed generation, normal cache hits and changed pipelines. The path depends on the Windows COFF output target, not exclusively on the host operating system. Checks that catchCompileErrorrun only when Halide supports exceptions; the normal object and assembly checks still run in exception-disabled builds.Before rebasing, verified locally with a full shared Halide build, both independently and together with the restore fix in #9438: three affected correctness tests pass; the combined build also passes both normal CMake cache integration tests, including generated-code execution. The standalone integer-add reproducer confirms locked
.libfailures with caching disabled and with a cold cache, correct recovery, and unchanged successful control bytes. The original wheel fails the new regressions; the after-open test also rejects the incomplete open/end-only fix. clang-format 21.1.8 andgit diff --checkpass.Environment: Windows x64, C++20, serialization enabled, LLVM 22.1.8, MSVC 19.42 compiler, isolated 14.44 linker/CRT libraries and SDK 10.0.22621.0. Static Halide linkage was not tested locally. This patch handles generation errors; failed cache restoration is covered separately by #9438.
The branch is rebased onto current
main, including #9436. The updatedcompile_totest passes locally with its exception guards enabled and disabled, using the previously validated COFF-fixed DLL. The updated head passes the GitHub Actions suite, including the Linux Makefile job; the remaining buildbot jobs are pending.Coverage is 87.5% for changed lines in the macOS report. The sole partial line is the final stream-state assertion; its failure branch is exercised by the Windows byte-range-lock regression, and Windows CI passes. The coverage report does not collect Windows execution.