From 5dd8f29443508bd8663a92c62d33e69cc47b61af Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:26:02 -0400 Subject: [PATCH] Cache address-space-legalization of `kIROp_Store` (#4480) * Cache address-space-legalization of `kIROp_Store` without caching we will infinetly loop re-processing the same `kIROp_Store` * uncomment tests which should now work with metal * disable gfx backend failing tests --- source/slang/slang-ir-specialize-address-space.cpp | 1 + .../types/opaque/inout-param-opaque-type-in-struct.slang | 1 + .../language-feature/types/opaque/inout-param-opaque-type.slang | 2 +- .../types/opaque/out-param-opaque-type-in-struct.slang | 1 + tests/language-feature/types/opaque/out-param-opaque-type.slang | 2 +- .../types/opaque/return-opaque-type-in-struct.slang | 1 + 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/slang/slang-ir-specialize-address-space.cpp b/source/slang/slang-ir-specialize-address-space.cpp index b16449f2e0..55d61d527f 100644 --- a/source/slang/slang-ir-specialize-address-space.cpp +++ b/source/slang/slang-ir-specialize-address-space.cpp @@ -220,6 +220,7 @@ namespace Slang if (addrSpace != AddressSpace::Generic) { mapVarValueToAddrSpace[inst->getOperand(0)] = addrSpace; + mapInstToAddrSpace[inst] = addrSpace; changed = true; } } diff --git a/tests/language-feature/types/opaque/inout-param-opaque-type-in-struct.slang b/tests/language-feature/types/opaque/inout-param-opaque-type-in-struct.slang index 64e4d968ac..3fc28812f1 100644 --- a/tests/language-feature/types/opaque/inout-param-opaque-type-in-struct.slang +++ b/tests/language-feature/types/opaque/inout-param-opaque-type-in-struct.slang @@ -4,6 +4,7 @@ // aggregate type that includes an opaque type //TEST(compute):COMPARE_COMPUTE: +// GFX backend fails //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl struct Things diff --git a/tests/language-feature/types/opaque/inout-param-opaque-type.slang b/tests/language-feature/types/opaque/inout-param-opaque-type.slang index eed42ca696..5da1e57e83 100644 --- a/tests/language-feature/types/opaque/inout-param-opaque-type.slang +++ b/tests/language-feature/types/opaque/inout-param-opaque-type.slang @@ -3,7 +3,7 @@ // Test that a function/method can have an `out` parameter of opaque type //TEST(compute):COMPARE_COMPUTE: -//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl +//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl //TEST_INPUT:set gX = ubuffer(data=[16 17 18 19], stride=4) RWStructuredBuffer gX; diff --git a/tests/language-feature/types/opaque/out-param-opaque-type-in-struct.slang b/tests/language-feature/types/opaque/out-param-opaque-type-in-struct.slang index a7c10c626b..c778e56fa7 100644 --- a/tests/language-feature/types/opaque/out-param-opaque-type-in-struct.slang +++ b/tests/language-feature/types/opaque/out-param-opaque-type-in-struct.slang @@ -4,6 +4,7 @@ // aggregate type that includes an opaque type //TEST(compute):COMPARE_COMPUTE: +// GFX backend fails //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl struct Things diff --git a/tests/language-feature/types/opaque/out-param-opaque-type.slang b/tests/language-feature/types/opaque/out-param-opaque-type.slang index c986400bbb..572481eb26 100644 --- a/tests/language-feature/types/opaque/out-param-opaque-type.slang +++ b/tests/language-feature/types/opaque/out-param-opaque-type.slang @@ -3,7 +3,7 @@ // Test that a function/method can have an `out` parameter of opaque type //TEST(compute):COMPARE_COMPUTE: -//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl +//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl //TEST_INPUT:set gThings = ubuffer(data=[16 17 18 19], stride=4) RWStructuredBuffer gThings; diff --git a/tests/language-feature/types/opaque/return-opaque-type-in-struct.slang b/tests/language-feature/types/opaque/return-opaque-type-in-struct.slang index a1a7150091..a53551d4ad 100644 --- a/tests/language-feature/types/opaque/return-opaque-type-in-struct.slang +++ b/tests/language-feature/types/opaque/return-opaque-type-in-struct.slang @@ -4,6 +4,7 @@ // aggregate type that includes an opaque type //TEST(compute):COMPARE_COMPUTE: +// GFX backend fails //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl struct Things