<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/162169>162169</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Miscompilation of `ElementWise_DequantizeLinear.*` DML shaders directly cause 110 operator test failures
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            miscompilation,
            backend:DirectX,
            HLSL
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Icohedron
      </td>
    </tr>
</table>

<pre>
    110 DML operator test failures consistent across devices with AMD, NVIDIA, and Intel GPUs are confirmed to be caused by the following shaders:
```
ElementWise_DequantizeLinearTyped_256_8_typed_c32_int
ElementWise_DequantizeLinearTyped_256_8_typed_c32_uint
ElementWise_DequantizeLinearTyped_256_4_typed_c32_uint
ElementWise_DequantizeLinearTyped_256_4_typed_c32_int
```

**Random sample of failing tests**
```
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#607
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#183
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#136
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#598
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#445
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#458
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#186
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#211
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#355
OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#41
```

## Sample Reproduction
```
> ./TE.exe DirectML.Test.OperatorTests.dll /name:"OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#607" /p:DisableMetacommands=1 /logOutput:low
Test Authoring and Execution Framework v10.72 for x64

StartGroup: OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#607
Error: Output Tensor #0:
Error: Tensor Sizes: 3,3,63,15
Error: Tensor Data Type: float16
Error: Index: 0120 @00000128 [0,0,8,0].  Ref: 0.6362304688 (0x3917). DML: -92.4375000000 (0xD5C7).  Abs: 93.073730.  Rel: 100.688282%.  Ulp: 25424
Error: Index: 0121 @00000129 [0,0,8,1].  Ref: 0.5625000000 (0x3880). DML: inf (0x7C00).  Abs: inf.  Rel: -nan(ind)%.  Ulp: 17280
Error: Index: 0122 @00000130 [0,0,8,2].  Ref: 0.1716308594 (0x317E).  DML: -0.5336914062 (0xB845).  Abs: 0.705322.  Rel: 132.159195%.  Ulp: 31033
Error: Index: 0123 @00000131 [0,0,8,3].  Ref: 2.0683593750 (0x4023).  DML: 1.7968750000 (0x3F30).  Abs: 0.271484.  Rel: 13.125590%.  Ulp: 243
Error: Index: 0124 @00000132 [0,0,8,4].  Ref: -1.7207031250 (0xBEE2).  DML: -110.6875000000 (0xD6EB).  Abs: 108.966797.  Rel: 98.445440%.  Ulp: 6153
Error: Index: 0125 @00000133 [0,0,8,5].  Ref: 1.5742187500 (0x3E4C).  DML: 1.3027343750 (0x3D36).  Abs: 0.271484.  Rel: 17.245658%.  Ulp: 278
Error: Index: 0126 @00000134 [0,0,8,6].  Ref: 0.1311035156 (0x3032).  DML: -1.7675781250 (0xBF12).  Abs: 1.898682.  Rel: 107.417127%.  Ulp: 28960
Error: Index: 0127 @00000135 [0,0,8,7].  Ref: -0.5932617188 (0xB8BF).  DML: inf (0x7C00).  Abs: inf.  Rel: -nan(ind)%.  Ulp: 49985
Error: Index: 0128 @00000136 [0,0,8,8]. Ref: 2.2597656250 (0x4085).  DML: -inf (0xFC00).  Abs: inf.  Rel: -nan(ind)%. Ulp: 17541
Error: 7172 / 8505 (84.326867%) of elements were found to be above tolerance.
Error: Max absolute delta: inf.  Allowed absolute tolerance: 0.020000.
Error: Max relative delta: 200.000000%.  Allowed relative tolerance: 1.000000%.
Error: Max ULP delta: 60203.  Allowed tolerance: 6 ULPs (float16).
Error: Verify: Fail [File: C:\workspace\DirectML\SharedToolingLib\External\Test\TaefHelper\TaefHelper.cpp, Function: TaefHelper::Fail, Line: 133]
EndGroup: OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#607 [Failed]

Summary of Non-passing Tests:
 OperatorTests::MatrixMultiplyIntegerToFloatLargeGemm#607 [Failed]

Summary: Total=1, Passed=0, Failed=1, Blocked=0, Not Run=0, Skipped=0
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0mEtz47gRxz8NdEEZBTSePOgg6zHrKnt2auzZ5OaCSMhmBiIUEvRjP30KpCSTzDqpjTYuySSFxh8_NprNBmzTlE-Vc3Mkr5FczWwbn0M9v8nDsyvqUM22oXifM0bx6u4Wh4OrbQw1jq6JeGdL39auwXmomrKJrorY5nVoGly4lzJ3DX4t4zNe3K0QLPHX325WN4t0ZqsC31TRefzl248G29oliV1Z712BY8Bbh3PbNq7A23ccnx3eBe_Da1k94ebZFq5uEF8gukCKHj90sfZu76r4t7Jxjyv3z9ZWsfzd3ZaVs_XD-8EVjyDVo3mM3XnO4bGs4v_Ur_0zHcVf0bHvN7zb9IH0-W6rIuxxY_cH73DYdZOSHJVmqOltJn1_PU7iQ2fBF4gv7mysy7e71sfy4N_T1Dy5-iFsfLDx1tZP7ovb7xFwRfVlAszwCwW4ukxAZuYyASHkhQLyQgJmLvQBMHaZAJeX-oD9UUBzBBzf96H83R3qULR5LEM1teVrTBBsHtbEvTm8KmuXx7tbkjjICIoU3mMEm8ruXQIEuDD4AZLcAfHFqmzs1rs7F20e9ntbFQ3iK5aafXj6tY2HNiK-8OEV0UUaDS-61JqezZT_1m8ub9PN4U1t9-411D_xC6NEA96FGr8p0XvlPto6fqlDmwbFFz-767oOdafUEeIHVzWhxgg47XPq2eDYcl_-7tJImCNYpq9K_5j8A9OVjRanDJZ-26XxmRqa3VSFe0snlAHFSNDuj4HBSF5TBMv0Nd1RrgjG392usyaKK-BUKGMwAkPfeMY0goykd1KyuMqACK5lL9jbrOSyt8GLbcefcUI115x2yj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