From 86a9da1573e1eea62fbaeddc97521f2b97ebc255 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Fri, 10 May 2024 17:32:09 -0700 Subject: Fix race-condition and visual artifacts issues (#4152) * Fix race-condition and visual artifacts issues In PerformanceProfiler::getProfiler() we return a static object for the profiler implementation, this is not thread-safe, so change it to thead_local. There is still some visual artifacts when using slang as the shading language. We don't know the root cause yet, but found out it's related to our loop inversion algorithm. So stage this feature for now, and turn it into an internal option and default off. We will re-enable it after more investigation on this optimization. File an new issue 4151 to track it. * Add '-loop-inversion' to the few tests --- tests/autodiff/path-tracer/pt-loop.slang | 4 ++-- tests/autodiff/reverse-while-loop-2.slang | 6 +++--- tests/cross-compile/loop-attribs.slang | 4 ++-- tests/ir/loop-inversion.slang | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/autodiff/path-tracer/pt-loop.slang b/tests/autodiff/path-tracer/pt-loop.slang index 2e865b80a..ac8bf763d 100644 --- a/tests/autodiff/path-tracer/pt-loop.slang +++ b/tests/autodiff/path-tracer/pt-loop.slang @@ -1,7 +1,7 @@ //Tests automatic synthesis of Differential type requirement. -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type -//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type -Xslang -loop-inversion +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -Xslang -loop-inversion //TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer RWStructuredBuffer outputBuffer; diff --git a/tests/autodiff/reverse-while-loop-2.slang b/tests/autodiff/reverse-while-loop-2.slang index 9ad9ac466..70b9d5a13 100644 --- a/tests/autodiff/reverse-while-loop-2.slang +++ b/tests/autodiff/reverse-while-loop-2.slang @@ -1,6 +1,6 @@ -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type -//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type -Xslang -loop-inversion +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -Xslang -loop-inversion +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj -Xslang -loop-inversion //TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer RWStructuredBuffer outputBuffer; diff --git a/tests/cross-compile/loop-attribs.slang b/tests/cross-compile/loop-attribs.slang index 4336698c0..dca3f2331 100644 --- a/tests/cross-compile/loop-attribs.slang +++ b/tests/cross-compile/loop-attribs.slang @@ -1,7 +1,7 @@ // loop-attribs.slang // Test that loop attributes are correctly emitted to the resulting HLSL. -//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 +//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 -loop-inversion float4 main() : SV_Target { @@ -16,4 +16,4 @@ float4 main() : SV_Target sum += float(j); return float4(sum, 0, 0, 0); -} \ No newline at end of file +} diff --git a/tests/ir/loop-inversion.slang b/tests/ir/loop-inversion.slang index 7e218a62a..7611c4062 100644 --- a/tests/ir/loop-inversion.slang +++ b/tests/ir/loop-inversion.slang @@ -1,4 +1,4 @@ -//TEST():SIMPLE(filecheck=CHECK):-entry computeMain -stage compute -line-directive-mode none -target hlsl +//TEST():SIMPLE(filecheck=CHECK):-entry computeMain -stage compute -line-directive-mode none -target hlsl -loop-inversion //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=OUT):-shaderobj -output-using-type //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=OUT):-dx12 -use-dxil -shaderobj -output-using-type //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=OUT):-cpu -shaderobj -output-using-type -- cgit v1.2.3