Rename candle's moe_gemm_wmma → candle_moe_gemm_wmma to avoid symbol collision with mistralrs-core#13
Merged
Merged
Conversation
… collision with mistralrs-core Both candle-kernels and mistralrs-core define an extern "C" void moe_gemm_wmma kernel with the same signature but incompatible implementations. When both crates are linked into the same binary (e.g. spiced with cuda + models features), ld.lld rejects the duplicate symbol. Prefix the candle side with 'candle_' so both can coexist; the mistralrs-core copy keeps the original name and call sites.
lukekim
added a commit
to spiceai/mistral.rs
that referenced
this pull request
Apr 17, 2026
…ollision) Picks up spiceai/candle#13 which renames candle-kernels' moe_gemm_wmma -> candle_moe_gemm_wmma so it no longer collides with mistralrs-core's identically-named but semantically divergent kernel when both crates are linked together (e.g. in spiced --features cuda,models).
lukekim
added a commit
to spiceai/text-embeddings-inference
that referenced
this pull request
Apr 17, 2026
Picks up spiceai/candle#13 which renames candle-kernels' moe_gemm_wmma -> candle_moe_gemm_wmma so it no longer collides with mistralrs-core's identically-named but semantically divergent kernel when both crates are linked together (e.g. in spiced --features cuda,models).
lukekim
added a commit
to spiceai/spiceai
that referenced
this pull request
Apr 17, 2026
Resolves ld.lld duplicate-symbol link error when building spiced with
cuda + models features:
ld.lld: error: duplicate symbol: moe_gemm_wmma
>>> defined in libmoe.a (candle-kernels)
>>> defined in libmistralrscuda.a (mistralrs-core)
Three coordinated fork PRs:
- spiceai/candle#13: rename moe_gemm_wmma -> candle_moe_gemm_wmma
in candle-kernels so it no longer collides with mistralrs-core's
identically-named but semantically divergent kernel.
- spiceai/mistral.rs#34: bump candle rev to 7de0d9fd.
- spiceai/text-embeddings-inference#22: bump candle rev to 7de0d9fd.
New workspace pins:
- candle fab4da81 -> 7de0d9fd
- mistralrs 9b475876 -> b93f7600
- text-embeddings b958dca5 -> bd66a55d
Verified with make install-cuda on CUDA 12.6 / sm_90 (H100): links
and installs cleanly in 18m51s.
lukekim
added a commit
to spiceai/mistral.rs
that referenced
this pull request
Apr 17, 2026
…ollision) Picks up spiceai/candle#13 which renames candle-kernels' moe_gemm_wmma -> candle_moe_gemm_wmma so it no longer collides with mistralrs-core's identically-named but semantically divergent kernel when both crates are linked together (e.g. in spiced --features cuda,models).
lukekim
added a commit
to spiceai/text-embeddings-inference
that referenced
this pull request
Apr 17, 2026
Picks up spiceai/candle#13 which renames candle-kernels' moe_gemm_wmma -> candle_moe_gemm_wmma so it no longer collides with mistralrs-core's identically-named but semantically divergent kernel when both crates are linked together (e.g. in spiced --features cuda,models).
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.
Problem
Linking
spicedwith--features cuda,modelsfails with:Both crates independently adapted the MoE WMMA kernel from guoqingbao/attention.rs and export it with the same
extern "C"name. When both crates are linked into the same binary (Spice.ai runtime uses candle for embeddings/TEI and mistral.rs for LLM inference), ld.lld rejects the duplicate symbol.Fix
Prefix the candle side of the symbol with
candle_so both kernels can coexist at link time:candle-kernels/src/moe/moe_wmma.cu:extern "C" void moe_gemm_wmma→extern "C" void candle_moe_gemm_wmmacandle-kernels/src/ffi.rs: FFI declaration updated to matchcandle-nn/src/moe.rs: call site updated to matchThe
mistralrs-corecopy (which also has amoe_gemm_wmma_transposedvariant unique to it) keeps its original name.Scope
candle-kernels::ffi::moe_gemm_wmma; no external callers affectedcandle-nn/src/moe.rsand the upstream-URL comment inmoe_wmma.cuintentionally preserve the originalmoe_gemm_wmmaname (they refer to the upstream author's name, not our symbol).Verification
Local build of
spiced --features cuda,modelson CUDA 12.6 / sm_90 (H100) links cleanly after this change is applied via workspace[patch]. Will re-verify with the merged SHA once this lands.