Skip to content

Ship native binaries for four RIDs - #4

Merged
jcant0n merged 5 commits into
mainfrom
fix/native-build-matrix
Aug 11, 2026
Merged

Ship native binaries for four RIDs#4
jcant0n merged 5 commits into
mainfrom
fix/native-build-matrix

Conversation

@jcant0n

@jcant0n jcant0n commented Aug 11, 2026

Copy link
Copy Markdown
Member

Completes phase 2: the package now carries the native Embree libraries, so it goes from
"compiles" to "works".

Binaries

Built by Build Embree Libraries at v4.4.1 with EMBREE_TASKING_SYSTEM=INTERNAL, so each
one is self-contained and nothing drags TBB into the package:

RID File
win-x64 embree4.dll
linux-x64 libembree4.so
linux-arm64 libembree4.so
osx-arm64 libembree4.dylib

rtcore_config.h is the file that build generated, vendored verbatim so diffing a future
artifact against it is trivial. It came out identical on all four platforms and matched the
hand-derived one semantically — regenerating against it produces byte-identical bindings.

Verified end to end on win-x64: HelloEmbree passes its struct-size assertions, traces the
scene with shadows, and its output folder contains no TBB.

Workflow fixes

Three legs needed work before any of this existed:

  • linux-x64 was being OOM-killed. An x64 build compiles the kernels once per ISA and
    those translation units are large, so four concurrent g++ processes exhausted the runner's
    16 GB. It surfaced as a job that died after 47 minutes with no logs and a Build step still
    marked in progress, rather than as a compiler error. Now --parallel 2.
  • The Windows legs were letting the Visual Studio generator pick its own platform. Now
    -A x64 / -A ARM64 explicitly.
  • A new only-rid input rebuilds a single leg. Iterating on one platform otherwise
    re-runs win-x64, which spends an hour compiling four ISAs with MSVC.

There is also a Check ARM detection step. Note it greps Embree's configure output rather
than CMakeCache.txt: EMBREE_ARM is set with a plain SET() and never reaches the cache, so
an assertion against the cache file fails on a perfectly good build — which is exactly what it
did, taking down three legs that had been fine.

win-arm64 is dropped

Embree 4.4.1 does not build for Windows on ARM with either toolset on the runner, for two
different reasons, both upstream. Details in #3, and the reasoning is recorded in the matrix
comment so the next person does not repeat it.

win-arm64: the Visual Studio generator was left to pick its own platform, which
on the ARM64 runner is not ARM64. Embree then took the x86 code path and
immintrin.h rejected the target outright. Pass -A ARM64 (and -A x64 for the
other Windows leg, so neither depends on a default), and assert EMBREE_ARM is ON
after configuring rather than discovering it halfway through a compile.

linux-x64: an x64 build compiles the kernels once per ISA and those translation
units are large, so four concurrent g++ processes exhausted the runner's 16 GB.
The OOM killer took the runner with them, which is why that job died after 47
minutes with no logs and a Build step still marked in progress. Two jobs there;
the NEON legs build a single ISA and keep four.
The check I added asserted EMBREE_ARM=ON in CMakeCache.txt, but Embree sets it
with a plain SET(), so it is never a cache entry and the grep could only ever
fail. It took down the three NEON legs, two of which had been building fine.

Embree prints 'Building for AArch64' / 'Building for Apple silicon' exactly when
it takes that path, so match on that instead. The -A ARM64 fix itself was
correct: win-arm64 now configures with CMAKE_GENERATOR_PLATFORM=ARM64, reports
AArch64 and no longer hits immintrin.h.
Configuring for ARM64 was necessary but not sufficient. Embree gates its ARM
code path on __ARM_NEON and __aarch64__, which are GCC/Clang predefines that
MSVC does not define on ARM64, so common/sys/intrinsics.h took its x86 branch
and included immintrin.h on an ARM target. That is a compile-time failure and no
amount of correct configuration avoids it; clang-cl defines both macros.

Also adds an only-rid input. Iterating on one platform otherwise re-runs
win-x64, which spends an hour compiling four ISAs with MSVC.
Configuring for ARM64 was necessary but not sufficient. Embree gates its ARM
code path on __ARM_NEON and __aarch64__, GCC/Clang predefines that MSVC does not
define on ARM64, so common/sys/intrinsics.h took its x86 branch and included
immintrin.h on an ARM target. That fails at compile time no matter how correct
the configuration is; clang-cl defines both macros.

The only-rid guard sits on the steps rather than the job: matrix values are not
in scope in a job-level if, which GitHub rejects when parsing the workflow.
Without it, iterating on one platform re-runs win-x64, an hour of MSVC
compiling four ISAs.
Built by Build Embree Libraries at v4.4.1 with EMBREE_TASKING_SYSTEM=INTERNAL, so
each library is self-contained and the package carries no TBB. rtcore_config.h is
the file that build generated, vendored verbatim so a future diff against a fresh
artifact is trivial; it turned out to match the hand-derived one semantically, and
regenerating against it produces byte-identical bindings.

Verified end to end on win-x64: HelloEmbree passes its struct-size assertions,
traces and shadows the scene, and the output folder carries no TBB at all.

win-arm64 is dropped. Embree 4.4.1 does not build for Windows on ARM with either
toolset: MSVC does not define the __ARM_NEON/__aarch64__ macros Embree gates its
ARM code path on, so it includes immintrin.h on an ARM target; clang-cl defines
them and clears that, only for Embree's CMake to feed -msse2 to an
arm64-pc-windows-msvc target. Both are upstream gaps in a configuration Embree
does not test, and working around the second means carrying a patch to its build
system for a kernel where a wrong SIMD path yields wrong intersections rather
than a crash.
@jcant0n
jcant0n merged commit 0a20f9d into main Aug 11, 2026
1 check passed
@jcant0n
jcant0n deleted the fix/native-build-matrix branch August 11, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant