[PR #3002] [CLOSED] metal: stub wait_handoff / handoff_publish so the Metal engine links on 0.1.45 #4393

Closed
opened 2026-11-07 15:35:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3002
Author: @bsvinay
Created: 10/18/2026
Status: ❌ Closed

Base: main ← Head: metal-handoff-stubs


📝 Commits (1)

  • 4f015cb metal: stubs for the layer split's overlapped hand-off (wait_handoff, handoff_publish)

📊 Changes

1 file changed (+23 additions, -0 deletions)

View changed files

➕ metal/src/engine/stubs_145.cpp (+23 -0)

📄 Description

Fixes the Mac link failure qiuzan2001 reported on #1120.

Verifier::record_window (src/core/verify.cpp, compiled into the Mac engine via metal/CMakeLists.txt) calls strata::kernels::wait_handoff and strata::kernels::handoff_publish since the overlapped hand-off landed. Both are defined only in src/kernels/cuda/verify_kernels.cu, and the generated metal/src/engine/stubs.cpp stubs the neighbouring wait_flag_ge / wait_flag_ge_or but not these two, so ld64 reports them undefined.

This adds metal/src/engine/stubs_145.cpp (a separate file, like stubs_144.cpp, so the generated stubs.cpp stays untouched), defining both with the header's exact signatures; each calls strata::metal_engine::missing(...) like the other stubs. The overlap is opt-in and needs two CUDA/HIP devices, so these are not reached on Metal.

Not built on a Mac (I don't have one); the signatures were checked against include/strata/kernels/verify_kernels.hpp on main. A Metal build to confirm the link would be appreciated.

Note: a static scan of 0.1.45 finds seven more entry points called from Metal-compiled sources (verify.cpp, mtp.cpp) with no Metal definition or stub: wait_flag_ge_stamped, wait_copy_i32_from_mapped, gdn_conv_ab_multi, gdn_step_norm_groups, gather_rows, argmax_rows_scratch_bytes, row_top_prob_scratch_bytes. @qiuzan2001, could you paste the full ld64 output? If those are undefined too, the right fix is regenerating stubs.cpp with metal/tools/gen_stubs.py from that log, and I can fold it into this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_016BbK25NizvXkQUCrF1kWAX


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3002 **Author:** [@bsvinay](https://github.com/bsvinay) **Created:** 10/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `metal-handoff-stubs` --- ### 📝 Commits (1) - [`4f015cb`](https://github.com/Niko1221/Strata/commit/4f015cbb104a4d6a21355afa196c810993bbc3f7) metal: stubs for the layer split's overlapped hand-off (wait_handoff, handoff_publish) ### 📊 Changes **1 file changed** (+23 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `metal/src/engine/stubs_145.cpp` (+23 -0) </details> ### 📄 Description Fixes the Mac link failure qiuzan2001 reported on #1120. `Verifier::record_window` (src/core/verify.cpp, compiled into the Mac engine via metal/CMakeLists.txt) calls `strata::kernels::wait_handoff` and `strata::kernels::handoff_publish` since the overlapped hand-off landed. Both are defined only in src/kernels/cuda/verify_kernels.cu, and the generated metal/src/engine/stubs.cpp stubs the neighbouring `wait_flag_ge` / `wait_flag_ge_or` but not these two, so ld64 reports them undefined. This adds `metal/src/engine/stubs_145.cpp` (a separate file, like stubs_144.cpp, so the generated stubs.cpp stays untouched), defining both with the header's exact signatures; each calls `strata::metal_engine::missing(...)` like the other stubs. The overlap is opt-in and needs two CUDA/HIP devices, so these are not reached on Metal. Not built on a Mac (I don't have one); the signatures were checked against include/strata/kernels/verify_kernels.hpp on main. A Metal build to confirm the link would be appreciated. Note: a static scan of 0.1.45 finds seven more entry points called from Metal-compiled sources (verify.cpp, mtp.cpp) with no Metal definition or stub: `wait_flag_ge_stamped`, `wait_copy_i32_from_mapped`, `gdn_conv_ab_multi`, `gdn_step_norm_groups`, `gather_rows`, `argmax_rows_scratch_bytes`, `row_top_prob_scratch_bytes`. @qiuzan2001, could you paste the full ld64 output? If those are undefined too, the right fix is regenerating stubs.cpp with metal/tools/gen_stubs.py from that log, and I can fold it into this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016BbK25NizvXkQUCrF1kWAX --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:35:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4393
No description provided.