summaryrefslogtreecommitdiff
path: root/tests/metal
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-07-19 02:05:33 -0400
committerGitHub <noreply@github.com>2024-07-18 23:05:33 -0700
commita00d603519d395d41b2f68c5874e8a708335a31a (patch)
tree114e3da71d3d95034e944edb0ffd1510f192418d /tests/metal
parent59dd133f1c52fb0a7a388f4a8f42234f4556a28a (diff)
Metal: `Interlocked` (atomic) member function support for buffers (#4655)
* Metal: `Interlocked` (atomic) member function support for buffers fixes: #4654 fixes: #4481 1. Add `Interlocked` (atomic) member function support for buffers to Metal 2. Fix `__getEquivalentStructuredBuffer` so it works with CPP/Metal targets * add `CompareStore` support * legalize RWByteAddressBuffer to fully replace StructuredBuffer * destroy replaced byte-addr buffer * cleanup as per review and add comment to explain why certain code exists * fix flow of byte-address-buffer replacement * toggle on option to translate byteAddrBuffer to StructuredBuffer * cleanup unused buffers * add treatGetEquivalentStructuredBufferAsGetThis flag to treat getEquivStructuredBuffer as a byteAddressBuffer * comment to explain `treatGetEquivalentStructuredBufferAsGetThis` --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/metal')
-rw-r--r--tests/metal/atomic-texture-buffer.slang4
-rw-r--r--tests/metal/atomic-texture-texture1d.slang10
-rw-r--r--tests/metal/atomic-texture-texture2d.slang8
-rw-r--r--tests/metal/atomic-texture-texture3d.slang4
4 files changed, 25 insertions, 1 deletions
diff --git a/tests/metal/atomic-texture-buffer.slang b/tests/metal/atomic-texture-buffer.slang
index b1a5bcf25..3e4eda94b 100644
--- a/tests/metal/atomic-texture-buffer.slang
+++ b/tests/metal/atomic-texture-buffer.slang
@@ -44,6 +44,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -59,6 +60,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intBuffer[0], valInt);
InterlockedAnd(intBuffer[0], valInt);
InterlockedMax(intBuffer[0], valInt);
@@ -73,6 +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);
InterlockedAdd(uintBuffer[0], valUInt);
InterlockedAnd(uintBuffer[0], valUInt);
@@ -88,6 +91,7 @@ void test()
InterlockedXor(uintBuffer[0], valUInt, originalValueUInt);
InterlockedExchange(uintBuffer[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintBuffer[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintBuffer[0], valUInt, compareValueUInt);
}
[numthreads(1, 1, 1)]
diff --git a/tests/metal/atomic-texture-texture1d.slang b/tests/metal/atomic-texture-texture1d.slang
index 52d3d15fd..70f639cb5 100644
--- a/tests/metal/atomic-texture-texture1d.slang
+++ b/tests/metal/atomic-texture-texture1d.slang
@@ -34,6 +34,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -49,6 +50,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intTexture1D[0], valInt);
InterlockedAnd(intTexture1D[0], valInt);
InterlockedMax(intTexture1D[0], valInt);
@@ -63,6 +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);
InterlockedAdd(uintTexture1D[0], valUInt);
InterlockedAnd(uintTexture1D[0], valUInt);
@@ -78,6 +81,7 @@ void test()
InterlockedXor(uintTexture1D[0], valUInt, originalValueUInt);
InterlockedExchange(uintTexture1D[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintTexture1D[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintTexture1D[0], valUInt, compareValueUInt);
// Texture1DArray
// METAL: .atomic_fetch_add
@@ -94,6 +98,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -109,6 +114,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intTexture1DArray[0], valInt);
InterlockedAnd(intTexture1DArray[0], valInt);
InterlockedMax(intTexture1DArray[0], valInt);
@@ -122,7 +128,8 @@ void test()
InterlockedOr(intTexture1DArray[0], valInt, originalValueInt);
InterlockedXor(intTexture1DArray[0], valInt, originalValueInt);
InterlockedExchange(intTexture1DArray[0], valInt, originalValueInt);
- InterlockedCompareExchange(intTexture1DArray[0], valInt, compareValueInt, originalValueInt);
+ InterlockedCompareExchange(intTexture1DArray[0], valInt, compareValueInt, originalValueUInt);
+ InterlockedCompareStore(intTexture1DArray[0], valUInt, compareValueUInt);
InterlockedAdd(uintTexture1DArray[0], valUInt);
InterlockedAnd(uintTexture1DArray[0], valUInt);
@@ -138,6 +145,7 @@ void test()
InterlockedXor(uintTexture1DArray[0], valUInt, originalValueUInt);
InterlockedExchange(uintTexture1DArray[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintTexture1DArray[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintTexture1DArray[0], valUInt, compareValueUInt);
}
[numthreads(1, 1, 1)]
diff --git a/tests/metal/atomic-texture-texture2d.slang b/tests/metal/atomic-texture-texture2d.slang
index e147eae22..b18c96168 100644
--- a/tests/metal/atomic-texture-texture2d.slang
+++ b/tests/metal/atomic-texture-texture2d.slang
@@ -34,6 +34,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -49,6 +50,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intTexture2D[0], valInt);
InterlockedAnd(intTexture2D[0], valInt);
InterlockedMax(intTexture2D[0], valInt);
@@ -63,6 +65,7 @@ void test()
InterlockedXor(intTexture2D[0], valInt, originalValueInt);
InterlockedExchange(intTexture2D[0], valInt, originalValueInt);
InterlockedCompareExchange(intTexture2D[0], valInt, compareValueInt, originalValueInt);
+ InterlockedCompareStore(intTexture2D[0], valUInt, compareValueUInt);
InterlockedAdd(uintTexture2D[0], valUInt);
InterlockedAnd(uintTexture2D[0], valUInt);
@@ -78,6 +81,7 @@ void test()
InterlockedXor(uintTexture2D[0], valUInt, originalValueUInt);
InterlockedExchange(uintTexture2D[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintTexture2D[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintTexture2D[0], valUInt, compareValueUInt);
// Texture2DArray
// METAL: .atomic_fetch_add
@@ -94,6 +98,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -109,6 +114,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intTexture2DArray[0], valInt);
InterlockedAnd(intTexture2DArray[0], valInt);
InterlockedMax(intTexture2DArray[0], valInt);
@@ -123,6 +129,7 @@ void test()
InterlockedXor(intTexture2DArray[0], valInt, originalValueInt);
InterlockedExchange(intTexture2DArray[0], valInt, originalValueInt);
InterlockedCompareExchange(intTexture2DArray[0], valInt, compareValueInt, originalValueInt);
+ InterlockedCompareStore(intTexture2DArray[0], valUInt, compareValueUInt);
InterlockedAdd(uintTexture2DArray[0], valUInt);
InterlockedAnd(uintTexture2DArray[0], valUInt);
@@ -138,6 +145,7 @@ void test()
InterlockedXor(uintTexture2DArray[0], valUInt, originalValueUInt);
InterlockedExchange(uintTexture2DArray[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintTexture2DArray[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintTexture2DArray[0], valUInt, compareValueUInt);
}
[numthreads(1, 1, 1)]
diff --git a/tests/metal/atomic-texture-texture3d.slang b/tests/metal/atomic-texture-texture3d.slang
index 5a97cc44f..755b941da 100644
--- a/tests/metal/atomic-texture-texture3d.slang
+++ b/tests/metal/atomic-texture-texture3d.slang
@@ -30,6 +30,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
// METAL: .atomic_fetch_add
// METAL: .atomic_fetch_and
@@ -45,6 +46,7 @@ void test()
// METAL: .atomic_fetch_xor
// METAL: .atomic_exchange
// METAL: .atomic_compare_exchange_weak
+// METAL: .atomic_compare_exchange_weak
InterlockedAdd(intTexture3D[0], valInt);
InterlockedAnd(intTexture3D[0], valInt);
InterlockedMax(intTexture3D[0], valInt);
@@ -59,6 +61,7 @@ void test()
InterlockedXor(intTexture3D[0], valInt, originalValueInt);
InterlockedExchange(intTexture3D[0], valInt, originalValueInt);
InterlockedCompareExchange(intTexture3D[0], valInt, compareValueInt, originalValueInt);
+ InterlockedCompareStore(intTexture3D[0], valUInt, compareValueUInt);
InterlockedAdd(uintTexture3D[0], valUInt);
InterlockedAnd(uintTexture3D[0], valUInt);
@@ -74,6 +77,7 @@ void test()
InterlockedXor(uintTexture3D[0], valUInt, originalValueUInt);
InterlockedExchange(uintTexture3D[0], valUInt, originalValueUInt);
InterlockedCompareExchange(uintTexture3D[0], valUInt, compareValueUInt, originalValueUInt);
+ InterlockedCompareStore(uintTexture3D[0], valUInt, compareValueUInt);
}