This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Split out a new -types crate so spirv-builder stops loading LLVM via dylibs.
#856
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.
Before this PR,
spirv-builderdepended onrustc_codegen_spirvnot just inCargo.toml, but also used some of its exports, which meantrustcwas linking anything usingspirv-builder(such as our example runners, that support hot reloading) againstlibrustc_codegen_spirv.so.The problem with that is that kind of dylib dependency is
rustc_codegen_spirvdepends onrustc_driverwhich depends onrustc_codegen_llvmwhich links (statically or dynamically) against LLVM, so LLVM's global ctors run.And then the Vulkan driver also gets loaded, and if it uses LLVM, it will also run LLVM global ctors.
Depending on dynamic linking/loading semantics, the LLVMs may get partially deduplicated and conflicts occur:
This problem is the same as the one mentioned in the recent blog post on Mesa's NIR:
This PR moves the couple definitions
spirv-builderneeds, out ofrustc_codegen_spirv, and into a newrustc_codegen_spirv-typescrate. That allows to avoid linking against any dylibs that would bring LLVM in.That makes
example-runner-wgpuwork again on Mesa's AMD Radeon Vulkan (RADV) driver, on Mesa 21.3.7 (though I am not entirely sure if the original breaking change was in Mesa, distro packaging, orspirv-builder).Also, for the GPU I was testing with (reported by RADV as "FIJI"), I've had to also drive-by halving of
max_push_constant_size, to match themaxPushConstantsSize = 128reported by the driver.