Add RISC-V scalar fallback support#318
Open
carlosqwqqwq wants to merge 1 commit into
Open
Conversation
Author
|
@microsoft-github-policy-service agree |
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.
Why
DirectXMath already contains a full scalar
_XM_NO_INTRINSICS_implementation for its core headers, but non-x86/non-ARM targets are currently rejected inDirectXMath.hbefore that fallback can be used. Forriscv64, this means the library fails during target detection even though the scalar backend is already present and suitable as a conservative portability path.What changed
Inc/DirectXMath.hso__riscvselects the existing_XM_NO_INTRINSICS_scalar backend instead of falling into the unsupported-target#error.CMakeLists.txtto emit a clear configure-time status message when the target processor matchesriscv*.README.mdto document thatriscv64currently uses the scalar no-intrinsics backend and does not claim any RISC-V vector or assembly implementation.Extensions/(SSE3,SSE4,AVX,AVX2,F16C,FMA3,FMA4) to reject__riscvexplicitly instead of implying they are only unsupported on ARM.Verification
cmake -S . -B build-native -G Ninja -DBUILD_TESTING=OFF -DBUILD_XDSP=OFF -DBUILD_SHMATH=OFFDirectXCollision.hand exercises:XMVectorSetXMVectorAddXMMatrixScalingXMVector4TransformBoundingSphere::Containssal.hon non-Windows targets, fetched the open-source header referenced by the upstream README:curl -L -o /tmp/sal/sal.h https://raw.githubusercontent.com/dotnet/runtime/v9.0.2/src/coreclr/pal/inc/rt/sal.hriscv64consumer withdockcross/linux-riscv64:"$CXX" -std=c++17 -O2 -static -I/tmp/sal -I/repo/Inc -I/repo/Extensions build-riscv-forced/dxmath_smoke.cpp -o /tmp/dxmath_smoke.riscv64file /tmp/dxmath_smoke.riscv64readelf -h /tmp/dxmath_smoke.riscv64qemu-riscv64successfully:dxmath-okExtensions/DirectXMathAVX.hunder forced__riscvnow fails immediately with the intended top-level error:AVX not supported on this platformNotes
riscv64validation uses the upstream-documented externalsal.hdependency rather than adding any new compatibility shim inside DirectXMath itself.