js: add foundry-local-sdk-winml SKU mirroring the python wheel pattern#804
Draft
bmehta001 wants to merge 1 commit into
Draft
js: add foundry-local-sdk-winml SKU mirroring the python wheel pattern#804bmehta001 wants to merge 1 commit into
bmehta001 wants to merge 1 commit into
Conversation
The standard `foundry-local-sdk` npm package ships `foundry_local.dll` alone, so JS callers who installed from npm only ever saw the CUDA + WebGPU execution providers — the WinML 2.x bootstrapper's `LoadLibraryW` call for `Microsoft.Windows.AI.MachineLearning.dll` would silently fail (the DLL was not in the tarball). This mirrors the same gap the python wheel solved by publishing a separate `foundry-local-sdk-winml` package. Add a Windows-only WinML SKU built from the existing `cpp-native-win-x64-winml` / `cpp-native-win-arm64-winml` pipeline artifacts: - `steps-build-js.yml`: new `isWinML` parameter; when true, also stage `Microsoft.Windows.AI.MachineLearning.dll` next to `foundry_local.dll` in `prebuilds/<plat>-<arch>/`. The WinML DLL is signed by Microsoft via NuGet, so it is intentionally excluded from the ESRP signing pattern. - `steps-pack-js.yml`: new `isWinML` parameter; rewrites the package name to `foundry-local-sdk-winml` via `npm pkg set name=...` before `npm pack`, and restricts the prebuilds-source list to win-x64 + win-arm64. Mirrors python's `FL_PYTHON_PACKAGE_NAME` mechanism but uses npm's first-class JSON editor instead of a PEP-517 shim. - `stages-js.yml`: refactor to take a `variant: base | winml` parameter (mirroring `stages-python.yml`). Base = existing 4-platform stages. WinML = new `js_build_winml_win_x64`, `js_build_winml_win_arm64`, `js_test_winml_win_x64`, `js_pack_winml` stages consuming the `cpp-native-win-*-winml` artifacts and producing `js-prebuild-winml-win-*` + `js-sdk-winml`. - `stages-sdk-v2.yml`: invoke `stages-js.yml` twice (base + winml), matching the C# and Python coordinators. - `sdk_v2/js/README.md`: document the two SKUs at the top, mirroring the python README's variant table. The WinML DLL (~922 KB) is bundled in the tarball because it is small enough to ship inline and avoids any install-time network hop for WinML support. `install-native.cjs` is unchanged — it still downloads ORT + GenAI at install time for both SKUs. This commit pairs with 01a2725 ("winml: load WinML DLL from foundry_local.dll's own directory") from the WinML 2.x EP downloads PR. With that fix + this packaging change, `npm install foundry-local-sdk-winml` returns all four execution providers (CUDA, WebGPU, OpenVINO, NvTensorRTRTX) out of the box. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Adds a Windows-only
foundry-local-sdk-winmlnpm package so JS callers can install WinML EP support out of the box, mirroring the existing python wheel pattern (foundry-local-sdkvsfoundry-local-sdk-winml).Why
The standard
foundry-local-sdknpm tarball shipsfoundry_local.dllalone. The WinML 2.x bootstrapper'sLoadLibraryW("Microsoft.Windows.AI.MachineLearning.dll")therefore failed silently on JS callers — they only ever saw CUDA + WebGPU, never OpenVINO / NvTensorRTRTX. The vitestdiscoverEpstest only asserts shape (Array.isArray(eps) === true), not contents, so this gap was never caught in CI.The python wheel has had this split for a while (
foundry-local-sdkvsfoundry-local-sdk-winml); this PR brings the JS SDK to parity.What changes
steps-build-js.ymlisWinMLparameter. When true, stagesMicrosoft.Windows.AI.MachineLearning.dllnext tofoundry_local.dllinprebuilds/<plat>-<arch>/. WinML DLL is signed by Microsoft via NuGet — intentionally excluded from the ESRP signing pattern (no re-sign).steps-pack-js.ymlisWinMLparameter. Rewrites the package name tofoundry-local-sdk-winmlvianpm pkg set name=...beforenpm pack; restricts the prebuilds-source list to win-x64 + win-arm64.stages-js.ymlvariant: base | winml. Base = existing 4-platform stages (unchanged). WinML = newjs_build_winml_win_x64,js_build_winml_win_arm64,js_test_winml_win_x64,js_pack_winmlconsumingcpp-native-win-*-winmlartifacts, producingjs-prebuild-winml-win-*+js-sdk-winml.stages-sdk-v2.ymlstages-js.ymltwice (base + winml), matching the C# and Python coordinators.sdk_v2/js/README.mdDistribution flow
foundry-local-sdkfoundry-local-sdk-winmlfoundry_local.dll(size unchanged)foundry_local.dll+Microsoft.Windows.AI.MachineLearning.dll(~922 KB)install-native.cjs)The WinML DLL is small enough (~922 KB) to bundle inline — no install-time network hop for WinML. ORT/GenAI are still NuGet-downloaded at install time for both SKUs.
Pairs with
This PR is stacked on top of #788 (WinML 2.x EP downloads). Specifically the fix at 01a2725 (
winml: load WinML DLL from foundry_local.dll's own directory), which makes the WinML bootstrapper resolveMicrosoft.Windows.AI.MachineLearning.dllrelative tofoundry_local.dll's own directory viaGetModuleHandleExW+LoadLibraryExW(LOAD_WITH_ALTERED_SEARCH_PATH). Without that fix the WinML DLL would not be found at runtime even when bundled next tofoundry_local.dll.When #788 merges, this PR's base should be re-pointed to
main.Validation
yaml.safe_load.npm pkg set name=foundry-local-sdk-winml+npm pkg get nameverified locally (mechanism is idempotent; package.json round-trips cleanly back tofoundry-local-sdk).stages-python.ymlvariant pattern exactly — samebase | winmlif-block split and same artifact-name convention.End-to-end verification (the WinML JS tarball returns 4 EPs) will happen on the first pipeline run after this PR's CI. Locally, the same code path was verified in #788 via
npm run copy-native:dev(which already bundles the WinML DLL) — the new pipeline staging matches the dev script's layout byte-for-byte.Out of scope
install-native.cjsunchanged. The WinML DLL is bundled at pack time, not downloaded at install time.copy-native.mjs(dev-only) unchanged — it already includes the WinML DLL for local testing.pack-prebuilds.mjs(not used by the pipeline) unchanged.