Skip to content

Moves the surrogate from the shared target\release\build\hls - #2038

Merged
simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-surrogate-cache
Nov 9, 2026
Merged

simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-surrogate-cache

Conversation

@simongdavies

Copy link
Copy Markdown
Member

This moves the surrogate from the shared target\release\build\hls directory into target\release\build\hyperlight-host-<hash>\out\hls. The nested Cargo invocation still uses a separate target directory, avoiding the lock conflict, but cache cleanup now preserves it inside the dependency’s build output.

Fix Windows builds failing after restoring a Rust dependency cache. Cache cleanup removes the surrogate binary but preserves the build-script state, leaving compilation trying to embed a missing file.

This caused the hyperlight-js Windows CI failure with #[derive(RustEmbed)] folder '…\hls\x86_64-pc-windows-msvc\release' does not exist.

…ory into `target\release\build\hyperlight-host-<hash>\out\hls`

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 13:35
@simongdavies simongdavies added the kind/bugfix For PRs that fix bugs label Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change placing the Windows surrogate’s build output under OUT_DIR/hls.

No open issues 🎉

What changed in this PR

Keeps the Windows surrogate binary inside Hyperlight’s dependency build output so Rust cache cleanup preserves the file needed for embedding.

Changes:

  • Places the surrogate’s nested Cargo target directory under OUT_DIR/hls.
  • Retains a separate target directory to avoid Cargo lock conflicts and documents the cache requirement.
File Description
src/​hyperlight_host/​build.rs Sets the surrogate target directory to OUT_DIR/hls and explains its placement.

Review effort: Balanced

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 1ba9394e087d
Baseline commit: 001b94a01a75

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 771.38 ns (➖ 1.03x slower)
vec_bytes 646.49 ns (➖ 1.12x slower)
373.29 µs (➖ 1.00x slower)

payload_allocation

slot_pool_segmented
262144 524.29 ns (➖ 1.00x faster)
65536 141.51 ns (➖ 1.03x faster)

sandboxes

create_initialized_and_drop
medium 12.84 ms (➖ 1.02x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
7.68 ns (➖ 1.00x slower) 7.69 ns (➖ 1.02x faster) 7.73 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 96.14 µs (➖ 1.06x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.41 µs (➖ 1.19x slower) 7.22 µs (➖ 1.01x slower)
65536 1.92 µs (➖ 1.08x faster) 2.09 µs (➖ 1.10x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 27.01 µs (➖ 1.01x faster)
65536 6.24 µs (➖ 1.02x faster) 6.17 µs (➖ 1.14x faster)
8192 1.09 µs (➖ 1.02x faster) 1.06 µs (➖ 1.04x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 745.04 ns (➖ 1.06x slower)
vec_bytes 543.84 ns (➖ 1.04x slower)
706.98 µs (➖ 1.04x slower)

payload_allocation

slot_pool_segmented
262144 532.17 ns (➖ 1.01x faster)
65536 167.55 ns (➖ 1.16x faster)

sandboxes

create_initialized_and_drop
medium 14.41 ms (➖ 1.06x faster)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
7.36 ns (➖ 1.01x faster) 7.36 ns (➖ 1.00x faster) 7.36 ns (➖ 1.01x faster)

snapshot_files

load_snapshot_unverified
small 54.53 µs (➖ 1.04x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.20 µs (➖ 1.00x slower) 8.20 µs (➖ 1.01x slower)
65536 2.31 µs (➖ 1.00x slower) 2.31 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 31.71 µs (➖ 1.00x slower)
65536 7.75 µs (➖ 1.00x slower) 7.71 µs (➖ 1.00x faster)
8192 765.68 ns (➖ 1.01x faster) 784.72 ns (➖ 1.02x faster)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 913.50 ns (➖ 1.00x slower)
vec_bytes 704.43 ns (➖ 1.01x slower)
333.77 µs (➖ 1.05x slower)

payload_allocation

slot_pool_segmented
262144 677.64 ns (➖ 1.04x faster)
65536 182.40 ns (➖ 1.03x faster)

sandboxes

create_initialized_and_drop
medium 72.04 ms (➖ 1.05x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
10.03 ns (➖ 1.01x slower) 9.87 ns (➖ 1.00x faster) 10.22 ns (➖ 1.03x slower)

snapshot_files

load_snapshot_unverified
small 115.25 µs (➖ 1.07x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 11.96 µs (➖ 1.12x slower) 9.00 µs (➖ 1.07x faster)
65536 2.48 µs (➖ 1.01x slower) 2.61 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 34.65 µs (➖ 1.15x faster)
65536 7.88 µs (➖ 1.02x faster) 7.98 µs (➖ 1.02x faster)
8192 1.26 µs (➖ 1.02x faster) 1.45 µs (➖ 1.13x slower)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 926.84 ns (➖ 1.01x slower)
vec_bytes 676.40 ns (➖ 1.03x slower)
698.84 µs (➖ 1.00x slower)

payload_allocation

slot_pool_segmented
262144 695.99 ns (➖ 1.02x slower)
65536 264.38 ns (➖ 1.13x slower)

sandboxes

create_initialized_and_drop
medium 78.40 ms (➖ 1.57x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
8.73 ns (➖ 1.11x faster) 10.01 ns (➖ 1.14x faster) 8.68 ns (➖ 1.17x faster)

snapshot_files

load_snapshot_unverified
small 54.00 µs (➖ 1.02x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 8.07 µs (➖ 1.00x slower) 7.95 µs (➖ 1.02x faster)
65536 2.29 µs (➖ 1.01x slower) 2.27 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 37.62 µs (➖ 1.06x faster)
65536 7.48 µs (➖ 1.00x slower) 7.57 µs (➖ 1.00x slower)
8192 914.05 ns (➖ 1.00x slower) 901.56 ns (➖ 1.02x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.28 µs (➖ 1.05x slower)
vec_bytes 883.44 ns (➖ 1.10x slower)
1.99 ms (➖ 1.00x slower)

payload_allocation

slot_pool_segmented
262144 796.05 ns (➖ 1.14x faster)
65536 230.57 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 13.41 ms (➖ 1.24x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
10.36 ns (➖ 1.01x slower) 12.71 ns (➖ 1.25x slower) 9.96 ns (➖ 1.01x faster)

snapshot_files

load_snapshot_unverified
small 801.12 µs (➖ 1.04x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 9.24 µs (➖ 1.01x slower) 10.06 µs (➖ 1.09x slower)
65536 2.34 µs (➖ 1.09x faster) 2.84 µs (➖ 1.19x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 38.41 µs (➖ 1.21x faster)
65536 9.32 µs (➖ 1.07x faster) 8.91 µs (➖ 1.02x slower)
8192 1.24 µs (➖ 1.06x faster) 1.23 µs (➖ 1.03x faster)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.24 µs (➖ 1.01x slower)
vec_bytes 807.44 ns (➖ 1.00x slower)
3.28 ms (➖ 1.02x slower)

payload_allocation

slot_pool_segmented
262144 753.42 ns (➖ 1.00x faster)
65536 212.05 ns (➖ 1.34x faster)

sandboxes

create_initialized_and_drop
medium 17.92 ms (➖ 1.14x slower)

slot_pool

alloc_dealloc_128 alloc_dealloc_4096 alloc_dealloc_1500
9.76 ns (➖ 1.01x faster) 10.42 ns (➖ 1.03x slower) 9.67 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 684.33 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
262144 7.47 µs (➖ 1.03x faster) 7.63 µs (➖ 1.01x faster)
65536 2.47 µs (➖ 1.07x slower) 2.30 µs (➖ 1.02x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
262144 42.63 µs (➖ 1.04x slower)
65536 8.78 µs (➖ 1.06x faster) 9.17 µs (➖ 1.11x slower)
8192 1.08 µs (➖ 1.02x slower) 1.05 µs (➖ 1.10x faster)

Reported by cargo ci bench-report --candidate run:42626871141 --config-file bench_report.toml.

simongdavies added a commit to hyperlight-dev/hyperlight-js that referenced this pull request Nov 9, 2026
…T_DIR (#404)

This is a temporary fix until a hyperlight release with [this
fix](hyperlight-dev/hyperlight#2038) is
available.

This prevents failures like
[this](https://github.com/hyperlight-dev/hyperlight-js/actions/runs/42554800118/job/128958039351).

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
@simongdavies
simongdavies merged commit dac0bfe into hyperlight-dev:main Nov 9, 2026
63 checks passed
ludfjig added a commit to hyperlight-dev/hyperlight-wasm that referenced this pull request Nov 9, 2026
* Clean hyperlight-host in Windows jobs after restoring the cache,
because rust-cache deletes the surrogate it builds outside OUT_DIR and
every Windows build fails, as in hyperlight-dev/hyperlight-js#404 (until
hyperlight-dev/hyperlight#2038 is released).
* Stop caching Linux arm64 builds, because the caches total 10.6 GB over
the 10 GB quota and those jobs aren't on the critical path.

---------

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants