DXMT: add LLVM build compatibility fixes#748
Conversation
|
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
4550410 to
edc4e12
Compare
edc4e12 to
b9b0359
Compare
Derive VBoxDxMt LLVM link libraries from llvm-config when available, so shared libLLVM installs are not tied to a hard-coded LLVM major version. Keep the existing component-library list as a fallback for devtools trees without llvm-config. Keep the AIR argmemonly attribute source-compatible with LLVM 15 and LLVM 16+ by using the older enum attribute before the MemoryEffects API. Remove remaining AIR conversion dependencies on typed pointer introspection by passing explicit element types into GEP construction. For LLVM 15 typed-pointer builds, preserve the aggregate element type where needed so IRBuilder does not assert on mismatched GEP source element types. Use a local shuffle-mask sentinel to avoid depending on LLVM-version-specific names. Signed-off-by: Roberto Nibali <rnibali@gmail.com>
b9b0359 to
eb0e48d
Compare
|
I checked DXMT v0.80 before deciding whether this PR should instead be replaced by a vendored DXMT update. Result: v0.80 does not make this compatibility patch obsolete. It includes the separate CPU encoding heap fix from upstream DXMT, but it still has LLVM API drift in the AIR converter code:
So a future DXMT v0.80 vendor refresh may still be valuable, but it would need its own follow-up LLVM compatibility work for the newer |
|
DXMT v0.80 audit update: Updating the vendored DXMT tree to v0.80 would not currently remove the need for the source-compatibility parts of this PR. I checked DXMT v0.80 ( I opened the upstream DXMT source-compatibility issue here: 3Shain/dxmt#185 The VirtualBox
If VirtualBox later imports a DXMT version that resolves those upstream items, this PR can be reduced or replaced accordingly. |
Summary
Add minimal DXMT/LLVM compatibility fixes. These are independent from the earlier GUI repaint and HiDPI work.
The
VBoxDxMtlink now derives LLVM libraries from the configuredllvm-configwhen available. That avoids hard-coding a HomebrewlibLLVM-N.dylibname and supports shared LLVM packages, while preserving the original component-library list as a fallback for Oracle/devtools trees withoutllvm-config.The AIR
argmemonlyattribute handling is version-gated: LLVM 15 and older use the original enum attribute path, while LLVM 16 and newer use theMemoryEffectsAPI required by LLVM 17+.The AIR/DXBC conversion code now passes explicit element types into GEP construction instead of relying on typed-pointer introspection. For LLVM 15 typed-pointer builds, the vector-array helper preserves the aggregate element type where needed so
IRBuilder::CreateGEPdoes not assert on mismatched source element types. The shuffle-mask sentinel is also kept local so the code is not tied to an LLVM-version-specific mask constant name.Why
The pointer/API issues are real DXMT/LLVM compatibility bugs:
getNonOpaquePointerElementType()is invalid once LLVM opaque pointers are in use.ArgMemOnlyversusMemoryEffects::argMemOnly()is LLVM API drift.Compatibility note
This patch intentionally does not hard-code
libLLVM-15.dylib. The source should build against LLVM 15 and newer LLVM APIs where possible, while keeping the link flexible throughllvm-configand preserving the static component-library fallback.On the macOS/Arm test host, the installed VirtualBox 7.2.12
VBoxDxMt.dylibdoes not have a dynamiclibLLVM-17.dylibdependency according tootool -L. It contains LLVM symbols directly, andstringsreportsllvm-mc (based on LLVM 15.0.7). That suggests the shipped binary may still be produced through an LLVM 15-era static component-library toolchain.For the macOS/Arm Metal/AIR path, LLVM 15.0.7 is the currently verified producer. Local LLVM 17/22 builds can get further through the source build, but newer upstream LLVM bitcode may not be accepted by Apple's Metal compiler without a downgrade/normalization layer or a different shader handoff boundary; this showed up locally as
Failed to upgrade function bitcode.Validation
origin/main.git diff --checkpasses.VBoxDxMtsuccessfully with Homebrew LLVM 15.0.7:VBOX_LLVM_PATH=/opt/homebrew/opt/llvm@15VBOX_LLVM_CONFIG=/opt/homebrew/opt/llvm@15/bin/llvm-configotool -L out/darwin.arm64/release/dist/VirtualBox.app/Contents/MacOS/VBoxDxMt.dylibshows/opt/homebrew/opt/llvm@15/lib/libLLVM.dylibwith current version15.0.7.Refs #742.