From cc93e2c3523f558ee85281f7fe98e220f058f5ed Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 Aug 2025 09:29:23 -0700 Subject: Fix constructor overload ambiguity with scalar and vector parameters (#8109) Close #8090. When we do type coerce, we use a cache to store the conversion cost of different type. The key of the cache is defined by struct BasicTypeKey { uint32_t baseType : 8; uint32_t dim1 : 4; uint32_t dim2 : 4; ... } where dim1 and dim2 is used for dimension of vector and matrix. However the dim is only 4 bits, so `vector` will have the same key as `int`, which is wrong. Fix the issue by extending it to 8 bit. Also to make the hash key still within 32 bits, we adjust baseType to 5 bits, and knownConstantBitCount to 6 bits. --------- Co-authored-by: kaizhangNV --- tests/metal/atomic-texture-buffer.slang | 2 +- tests/metal/atomic-texture-texture1d.slang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/metal/atomic-texture-buffer.slang b/tests/metal/atomic-texture-buffer.slang index 1db156364..9f24018c7 100644 --- a/tests/metal/atomic-texture-buffer.slang +++ b/tests/metal/atomic-texture-buffer.slang @@ -75,7 +75,7 @@ void test() InterlockedXor(intBuffer[0], valInt, originalValueInt); InterlockedExchange(intBuffer[0], valInt, originalValueInt); InterlockedCompareExchange(intBuffer[0], valInt, compareValueInt, originalValueInt); - InterlockedCompareStore(intBuffer[0], valUInt, compareValueUInt); + InterlockedCompareStore(intBuffer[0], valInt, compareValueUInt); InterlockedAdd(uintBuffer[0], valUInt); InterlockedAnd(uintBuffer[0], valUInt); diff --git a/tests/metal/atomic-texture-texture1d.slang b/tests/metal/atomic-texture-texture1d.slang index 8a47af8ee..746021fd6 100644 --- a/tests/metal/atomic-texture-texture1d.slang +++ b/tests/metal/atomic-texture-texture1d.slang @@ -65,7 +65,7 @@ void test() InterlockedXor(intTexture1D[0], valInt, originalValueInt); InterlockedExchange(intTexture1D[0], valInt, originalValueInt); InterlockedCompareExchange(intTexture1D[0], valInt, compareValueInt, originalValueInt); - InterlockedCompareStore(intTexture1D[0], valUInt, compareValueUInt); + InterlockedCompareStore(intTexture1D[0], valInt, compareValueUInt); InterlockedAdd(uintTexture1D[0], valUInt); InterlockedAnd(uintTexture1D[0], valUInt); -- cgit v1.2.3