소스 검색

Correct QuadRead index (#3298)

Corrected quadread index calculation which was not fully updated

Also ups priority only skipping when warp is used so this won't be
missed again and improves the error output by using equals macros
Greg Roth 4 년 전
부모
커밋
424d0a2ac6
1개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 13 13
      tools/clang/unittests/HLSL/ExecutionTest.cpp

+ 13 - 13
tools/clang/unittests/HLSL/ExecutionTest.cpp

@@ -307,10 +307,7 @@ public:
   TEST_METHOD(AtomicsFloatTest);
   TEST_METHOD(AtomicsFloatTest);
   TEST_METHOD(SignatureResourcesTest)
   TEST_METHOD(SignatureResourcesTest)
   TEST_METHOD(DynamicResourcesTest)
   TEST_METHOD(DynamicResourcesTest)
-
-  BEGIN_TEST_METHOD(QuadReadTest)
-    TEST_METHOD_PROPERTY(L"Priority", L"2") // Remove this line once warp supports this feature in Shader Model 6.0
-  END_TEST_METHOD()
+  TEST_METHOD(QuadReadTest)
 
 
   BEGIN_TEST_METHOD(CBufferTestHalf)
   BEGIN_TEST_METHOD(CBufferTestHalf)
     TEST_METHOD_PROPERTY(L"Priority", L"2") // Remove this line once warp supports this feature in Shader Model 6.2
     TEST_METHOD_PROPERTY(L"Priority", L"2") // Remove this line once warp supports this feature in Shader Model 6.2
@@ -3097,10 +3094,10 @@ TEST_F(ExecutionTest, DerivativesTest) {
 void VerifyQuadReadResults(const UINT *pPixels, UINT quadIndex) {
 void VerifyQuadReadResults(const UINT *pPixels, UINT quadIndex) {
   for (UINT i = 0; i < 4; i++) {
   for (UINT i = 0; i < 4; i++) {
     UINT ix = quadIndex + i;
     UINT ix = quadIndex + i;
-    VERIFY_IS_TRUE(pPixels[4*ix + 0] == ix); // ReadLaneAt own quad index
-    VERIFY_IS_TRUE(pPixels[4*ix + 1] == (ix^1));// ReadAcrossX
-    VERIFY_IS_TRUE(pPixels[4*ix + 2] == (ix^2));// ReadAcrossY
-    VERIFY_IS_TRUE(pPixels[4*ix + 3] == (ix^3));// ReadAcrossDiagonal
+    VERIFY_ARE_EQUAL(pPixels[4*ix + 0], ix); // ReadLaneAt own quad index
+    VERIFY_ARE_EQUAL(pPixels[4*ix + 1], (ix^1));// ReadAcrossX
+    VERIFY_ARE_EQUAL(pPixels[4*ix + 2], (ix^2));// ReadAcrossY
+    VERIFY_ARE_EQUAL(pPixels[4*ix + 3], (ix^3));// ReadAcrossDiagonal
   }
   }
 }
 }
 
 
@@ -3114,6 +3111,12 @@ TEST_F(ExecutionTest, QuadReadTest) {
   if (!CreateDevice(&pDevice))
   if (!CreateDevice(&pDevice))
     return;
     return;
 
 
+  if (GetTestParamUseWARP(UseWarpByDefault())) {
+    WEX::Logging::Log::Comment(L"WARP does not support QuadRead in compute shaders.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   std::shared_ptr<st::ShaderOpSet> ShaderOpSet =
   std::shared_ptr<st::ShaderOpSet> ShaderOpSet =
     std::make_shared<st::ShaderOpSet>();
     std::make_shared<st::ShaderOpSet>();
   st::ParseShaderOpSetFromStream(pStream, ShaderOpSet.get());
   st::ParseShaderOpSetFromStream(pStream, ShaderOpSet.get());
@@ -3148,7 +3151,6 @@ TEST_F(ExecutionTest, QuadReadTest) {
     UINT mwidth = D.mx;
     UINT mwidth = D.mx;
     UINT mheight = D.my;
     UINT mheight = D.my;
     UINT mdepth = D.mz;
     UINT mdepth = D.mz;
-    UINT pixelSize = 4; // always int4
     // format compiler args
     // format compiler args
     char compilerOptions[256];
     char compilerOptions[256];
     VERIFY_IS_TRUE(sprintf_s(compilerOptions, sizeof(compilerOptions),
     VERIFY_IS_TRUE(sprintf_s(compilerOptions, sizeof(compilerOptions),
@@ -3173,8 +3175,7 @@ TEST_F(ExecutionTest, QuadReadTest) {
 
 
     // To find roughly the center for compute, divide the pixel count in half
     // To find roughly the center for compute, divide the pixel count in half
     // and truncate to next lowest power of 4 to start at a quad
     // and truncate to next lowest power of 4 to start at a quad
-    UINT centerIndex = ((UINT64)(width * height * depth)/2) & ~0x3;
-    UINT offsetCenter = centerIndex * pixelSize;
+    UINT offsetCenter = ((UINT64)(width * height * depth)/2) & ~0x3;
 
 
     // Test first, second and center quads
     // Test first, second and center quads
     LogCommentFmt(L"Verifying QuadRead* in compute shader results");
     LogCommentFmt(L"Verifying QuadRead* in compute shader results");
@@ -3183,8 +3184,7 @@ TEST_F(ExecutionTest, QuadReadTest) {
     VerifyQuadReadResults(pPixels, offsetCenter);
     VerifyQuadReadResults(pPixels, offsetCenter);
 
 
     if (DoesDeviceSupportMeshAmpDerivatives(pDevice)) {
     if (DoesDeviceSupportMeshAmpDerivatives(pDevice)) {
-      centerIndex = ((UINT64)(mwidth * mheight * mdepth)/2) & ~0x3;
-      offsetCenter = centerIndex * pixelSize;
+      offsetCenter = ((UINT64)(mwidth * mheight * mdepth)/2) & ~0x3;
 
 
       // Disable CS so mesh goes forward
       // Disable CS so mesh goes forward
       pShaderOp->CS = nullptr;
       pShaderOp->CS = nullptr;