Skip to content

(2a/n) Add WASM/Emscripten compiler flags to third-party dependencies#17860

Open
s09g wants to merge 1 commit intopytorch:mainfrom
s09g:export-D94744813
Open

(2a/n) Add WASM/Emscripten compiler flags to third-party dependencies#17860
s09g wants to merge 1 commit intopytorch:mainfrom
s09g:export-D94744813

Conversation

@s09g
Copy link

@s09g s09g commented Mar 4, 2026

Summary:
Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
"error: --shared-memory is disallowed by .o because it was not
compiled with 'atomics' or 'bulk-memory' features."

Changes:

  • xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
  • runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
  • cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
  • clog/BUCK: Add wasm-emscripten compiler_flags
  • pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 4, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17860

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 1 Cancelled Job

As of commit 58c9b52 with merge base 122fdef (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 4, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Mar 4, 2026

@s09g has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94744813.

s09g added a commit to s09g/executorch that referenced this pull request Mar 4, 2026
…pytorch#17860)

Summary:
Pull Request resolved: pytorch#17860

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 48f85b5 to acfcd09 Compare March 4, 2026 23:31
@s09g
Copy link
Author

s09g commented Mar 5, 2026

@pytorchbot label "release notes: build"

@pytorch-bot pytorch-bot bot added the release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc. label Mar 5, 2026
@s09g s09g force-pushed the export-D94744813 branch from acfcd09 to 1845beb Compare March 5, 2026 01:20
s09g added a commit to s09g/executorch that referenced this pull request Mar 5, 2026
…pytorch#17860)

Summary:

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813
s09g added a commit to s09g/executorch that referenced this pull request Mar 5, 2026
…pytorch#17860)

Summary:
Pull Request resolved: pytorch#17860

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 1845beb to 146865f Compare March 5, 2026 01:24
s09g added a commit to s09g/executorch that referenced this pull request Mar 5, 2026
…pytorch#17860)

Summary:

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 146865f to dd114f2 Compare March 5, 2026 01:27
s09g added a commit to s09g/pytorch that referenced this pull request Mar 5, 2026
…-party dependencies

Summary:
X-link: pytorch/executorch#17860

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Test Plan:
```
$ buck build fbsource//third-party/cpuinfo:cpuinfo
BUILD SUCCEEDED

$ buck build fbsource//xplat/third-party/pthreadpool:pthreadpool
BUILD SUCCEEDED

$ buck build fbsource//xplat/third-party/clog:clog
BUILD SUCCEEDED
```

Reviewed By: GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from dd114f2 to 2c8af37 Compare March 5, 2026 06:57
s09g added a commit to s09g/executorch that referenced this pull request Mar 5, 2026
…pytorch#17860)

Summary:

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: GregoryComer

Differential Revision: D94744813
s09g added a commit to s09g/pytorch that referenced this pull request Mar 5, 2026
…-party dependencies

Summary:
X-link: pytorch/executorch#17860

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: GregoryComer

Differential Revision: D94744813
Copy link
Contributor

@8Keep 8Keep left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@s09g s09g force-pushed the export-D94744813 branch from 2c8af37 to 1cd24db Compare March 6, 2026 01:28
s09g added a commit to s09g/executorch that referenced this pull request Mar 6, 2026
…pytorch#17860)

Summary:
X-link: pytorch/pytorch#176542


Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
pytorch-bot bot pushed a commit to pytorch/pytorch that referenced this pull request Mar 6, 2026
…-party dependencies (#176542)

Summary:

X-link: pytorch/executorch#17860

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Mar 6, 2026

@s09g has imported this pull request. If you are a Meta employee, you can view this in D94744813.

s09g added a commit to s09g/executorch that referenced this pull request Mar 6, 2026
…pytorch#17860)

Summary:
Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Changes:
- xnnpack.buck.bzl (fbcode + xplat): Add WASM_EMSCRIPTEN_COMPILER_FLAGS select
- runtime_wrapper.bzl (fbcode + xplat): Add emcc compiler flags
- cpuinfo/BUCK: Add wasm-emscripten compatible_with, compiler_flags, and emscripten/init.c wrapper
- clog/BUCK: Add wasm-emscripten compiler_flags
- pthreadpool/BUCK: Add compiler_flags and WASM preprocessor_flags (condvar mode)

Reviewed By: GregoryComer

Differential Revision: D94744813

Pulled By: s09g
@s09g s09g force-pushed the export-D94744813 branch from 461f544 to 437a624 Compare March 6, 2026 19:30
@s09g
Copy link
Author

s09g commented Mar 6, 2026

@pytorchbot rerun -j "android / run-emulator"

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 6, 2026

❌ 🤖 pytorchbot command failed:

@pytorchbot: error: argument command: invalid choice: 'rerun' (choose from 'merge', 'revert', 'rebase', 'label', 'drci', 'lint', 'fix-lint', 'apply-lint', 'cherry-pick')

usage: @pytorchbot [-h]
                   
                   {merge,revert,rebase,label,drci,lint,fix-lint,apply-lint,cherry-pick}
                   ...

Try @pytorchbot --help for more info.

@s09g s09g force-pushed the export-D94744813 branch from 437a624 to 914bfeb Compare March 7, 2026 00:05
@s09g s09g force-pushed the export-D94744813 branch from 914bfeb to 21dc318 Compare March 7, 2026 01:06
s09g added a commit to s09g/executorch that referenced this pull request Mar 7, 2026
…pytorch#17860)

Summary:

X-link: pytorch/pytorch#176542


Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 21dc318 to 880c743 Compare March 7, 2026 22:43
s09g added a commit to s09g/pytorch that referenced this pull request Mar 7, 2026
…arty dependencies (pytorch#176542)

Summary:
X-link: pytorch/executorch#17860



Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
pytorch-bot bot pushed a commit to pytorch/pytorch that referenced this pull request Mar 7, 2026
…arty dependencies (#176542)

Summary:
X-link: pytorch/executorch#17860



Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
s09g added a commit to s09g/executorch that referenced this pull request Mar 7, 2026
…pytorch#17860)

Summary:

X-link: pytorch/pytorch#176542


Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 880c743 to 5081826 Compare March 7, 2026 22:43
…pytorch#17860)

Summary:
Pull Request resolved: pytorch#17860

X-link: pytorch/pytorch#176542

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
@s09g s09g force-pushed the export-D94744813 branch from 5081826 to 58c9b52 Compare March 7, 2026 22:47
s09g added a commit to s09g/pytorch that referenced this pull request Mar 7, 2026
…arty dependencies (pytorch#176542)

Summary:
X-link: pytorch/executorch#17860

Pull Request resolved: pytorch#176542

Add pthread compiler flags (-pthread, -matomics, -mbulk-memory) for
Emscripten/WASM builds across third-party dependencies and ExecuTorch
runtime wrapper.

These flags are required when linking into WASM binaries that use
-sUSE_PTHREADS=1. Without them, wasm-ld fails with:
  "error: --shared-memory is disallowed by <file>.o because it was not
   compiled with 'atomics' or 'bulk-memory' features."

Reviewed By: 8Keep, GregoryComer

Differential Revision: D94744813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants