From 49dc44605b2e2a0ee115a69865fa7d0b21188614 Mon Sep 17 00:00:00 2001 From: Misaki Date: Sun, 22 Feb 2026 11:57:49 +0900 Subject: [PATCH] Fixed the bug that Vector type in SPMD does not work as expected --- .gitea/workflows/publish-nuget.yaml | 12 ++++++++++-- .../Templates/MathV.Vector.gen.cs | 4 ++-- .../Templates/MathV.Vector.tt | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/publish-nuget.yaml b/.gitea/workflows/publish-nuget.yaml index fbc5949..db142e3 100644 --- a/.gitea/workflows/publish-nuget.yaml +++ b/.gitea/workflows/publish-nuget.yaml @@ -57,9 +57,17 @@ jobs: else echo "🆕 Version $VERSION of $PACKAGE_ID is new." - # 4. PACK (Packages the DLLs created above) + # 4. EXPLICIT BUILD (Creates the DLLs) + echo "Building $projfile..." + if ! dotnet build "$projfile" -c Release; then + echo "❌ Failed to build $projfile" + exit 1 + fi + + # 5. PACK (Packages the DLLs created above) echo "Packing $projfile..." - if ! dotnet pack "$projfile" -c Release -o ./artifacts; then + # We use --no-build because we just built it in step 4 + if ! dotnet pack "$projfile" -c Release -o ./artifacts --no-build; then echo "❌ Failed to pack $projfile" exit 1 fi diff --git a/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.gen.cs b/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.gen.cs index 31d9e61..4bffe64 100644 --- a/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.gen.cs +++ b/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.gen.cs @@ -395,7 +395,7 @@ public static unsafe partial class MathV where TLane : ISPMD where TNumber : unmanaged, INumber, IBinaryNumber, IMinMaxValue, IBitwiseOperators { - return a.x * b.x + a.y * b.y; + return a.x * b.x + a.y * b.y + a.z * b.z; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -689,7 +689,7 @@ public static unsafe partial class MathV where TLane : ISPMD where TNumber : unmanaged, INumber, IBinaryNumber, IMinMaxValue, IBitwiseOperators { - return a.x * b.x + a.y * b.y; + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.tt b/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.tt index c97b475..ee9da33 100644 --- a/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.tt +++ b/Misaki.HighPerformance.Mathematics.SPMD/Templates/MathV.Vector.tt @@ -140,7 +140,7 @@ public static unsafe partial class MathV <#= TLaneRestrictions #> <#= TNumberRestrictions #> { - return a.x * b.x + a.y * b.y; + return <#= ForEachDimension(dimension, i => $"a.{components[i]} * b.{components[i]}", " + ") #>; } [MethodImpl(MethodImplOptions.AggressiveInlining)]