Dxil.dll <= 1.5 compat: Fix RDAT break and validation tests (#3117)

Fix compatibility with released DXIL.dll binaries:
- 1.4: 18362 SDK
- 1.5: GitHub release v1.5.2003

There are expected test failures when run against 1.5 19041 SDK DXIL.dll,
due to later fixes in the GitHub v1.5.2003 release.  Tests that fail by
design on this DLL have a comment added.

Also moved readme text to more discoverable readme.
This commit is contained in:
Tex Riddell 2020-09-08 13:52:14 -07:00 коммит произвёл GitHub
Родитель c5e4626cf2
Коммит 8d9e1cbb86
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
17 изменённых файлов: 98 добавлений и 36 удалений

Просмотреть файл

@ -844,6 +844,8 @@ void OP::GetMinShaderModelAndMask(const llvm::CallInst *CI, bool bWithTranslatio
// validator 1.4 didn't exclude wave ops in mask
if (IsDxilOpWave(opcode))
mask = ((unsigned)1 << (unsigned)DXIL::ShaderKind::Invalid) - 1;
// These shader models don't exist before 1.5
mask &= ~(SFLAG(Amplification) | SFLAG(Mesh));
// validator 1.4 didn't have any additional rules applied:
return;
}

Просмотреть файл

@ -1,5 +1,5 @@
// RUN: %dxc -Zi -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_DB
// RUN: %dxc -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
// RUN: %dxilver 1.6 | %dxc -Zi -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_DB
// RUN: %dxilver 1.6 | %dxc -E main -T as_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
// CHK_DB: 23:5: error: For amplification shader with entry 'main', payload size 16400 is greater than maximum size of 16384 bytes.
// CHK_NODB: For amplification shader with entry 'main', payload size 16400 is greater than maximum size of 16384 bytes.

Просмотреть файл

@ -1,5 +1,5 @@
// RUN: %dxc -Zi -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_DB
// RUN: %dxc -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
// RUN: %dxilver 1.6 | %dxc -Zi -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_DB
// RUN: %dxilver 1.6 | %dxc -E main -T ms_6_5 %s | FileCheck %s -check-prefix=CHK_NODB
// CHK_DB: :29: error: For mesh shader with entry 'main', payload size 16404 is greater than maximum size of 16384 bytes.
// CHK_NODB: error: For mesh shader with entry 'main', payload size 16404 is greater than maximum size of 16384 bytes. Use /Zi for source location.

Просмотреть файл

@ -1 +1,26 @@
Files in this directory are executed using FileCheck in a batch mode.
Files in this directory are executed using FileCheck in a batch mode.
There is a confirmation bias problem when testing debug info using file-check.
Say your test file contains:
// RUN: %dxc -E main -T vs_6_0 -Zi %s | FileCheck %s
// CHECK: foo
void main() {}
Due to /Zi, the !dx.source.contents metadata will be present and contain a string
with the original source file. This means that the generated file contains your
"// CHECK: foo", and hence the "foo" itself, so the check will succeed by default!
The current workaround is to include the following in your test to explicitly match
the quoted source file:
// Exclude quoted source file (see readme)
// CHECK-LABEL: {{!"[^"]*\\0A[^"]*"}}
This will match a metadata string containing \0A (newline), which should only appear
in the quoted source file. It will not match itself in the quoted source file because
the regex won't match itself, and even less the escaped version of itself.
Note that if you see a failure on that line, it means that something else before that
CHECK failed to match.

Просмотреть файл

@ -1,23 +0,0 @@
There is a confirmation bias problem when testing debug info using file-check.
Say your test file contains:
// RUN: %dxc -E main -T vs_6_0 -Zi %s | FileCheck %s
// CHECK: foo
void main() {}
Due to /Zi, the !dx.source.contents metadata will be present and contain a string
with the original source file. This means that the generated file contains your
"// CHECK: foo", and hence the "foo" itself, so the check will succeed by default!
The current workaround is to include the following in your test to explicitly match
the quoted source file:
// Exclude quoted source file (see readme)
// CHECK-LABEL: {{!"[^"]*\\0A[^"]*"}}
This will match a metadata string containing \0A (newline), which should only appear
in the quoted source file. It will not match itself in the quoted source file because
the regex won't match itself, and even less the escaped version of itself.
Note that if you see a failure on that line, it means that something else before that
CHECK failed to match.

Просмотреть файл

@ -1,4 +1,4 @@
// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_2 -HV 2018 -enable-16bit-types %s | FileCheck %s
// RUN: %dxilver 1.6 | %dxc -E main -T ps_6_2 -HV 2018 -enable-16bit-types %s | FileCheck %s
// CHECK: call i32 @dx.op.attributeAtVertex.i32(i32 137, i32 0, i32 0, i8 0, i8 0)
// CHECK: call i32 @dx.op.attributeAtVertex.i32(i32 137, i32 0, i32 0, i8 1, i8 0)

Просмотреть файл

@ -1,4 +1,6 @@
// RUN: %dxc -T lib_6_3 %s | FileCheck %s
// Test failure expected when run with 19041 SDK DXIL.dll
StructuredBuffer<int> buf[]: register(t2);
// CHECK: @dx.break.cond = internal constant

Просмотреть файл

@ -1,4 +1,6 @@
// RUN: %dxc -T lib_6_3 %s | FileCheck %s
// Test failure expected when run with 19041 SDK DXIL.dll
// When a conditional break block follows a conditional while loop entry,
// There can be some merging of conditionals, particularly when the dx.break
// adds a conditional of its own. This ensures they are handled appropriately.

Просмотреть файл

@ -1,4 +1,4 @@
// RUN: %dxc -T ps_6_5 -DTYPE=double %s | %FileCheck %s
// RUN: %dxilver 1.6 | %dxc -T ps_6_5 -DTYPE=double %s | %FileCheck %s
// RUN: %dxc -T ps_6_5 -DTYPE=float %s | %FileCheck %s
// RUN: %dxc -T ps_6_5 -DTYPE=int %s | %FileCheck %s
// RUN: %dxc -T ps_6_5 -DTYPE=uint %s | %FileCheck %s

Просмотреть файл

@ -1,4 +1,5 @@
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
// RUN: %dxilver 1.5 | %dxc -E main -T ps_6_0 %s | FileCheck %s
// Test failure expected when run with 19041 SDK DXIL.dll
SamplerState samp1 : register(s5);
Texture2D<float4> text1 : register(t3);

Просмотреть файл

@ -1,4 +1,5 @@
// RUN: %dxc -T lib_6_3 -auto-binding-space 11 %s | FileCheck %s
// Test failure expected when run with 19041 SDK DXIL.dll
// CHECK: %[[_7_:[0-9]+]] = call %dx.types.ResRet.f32 @dx.op.sampleLevel.f32(i32 62,
// CHECK: %[[_8_:[0-9]+]] = extractvalue %dx.types.ResRet.f32 %[[_7_]], 0

Просмотреть файл

@ -1,4 +1,5 @@
// RUN: %dxc -T lib_6_3 -auto-binding-space 11 %s | FileCheck %s
// Test failure expected when run with 19041 SDK DXIL.dll
// CHECK: %[[RayTCurrent:RayTCurrent|[0-9]+]] = call float @dx.op.rayTCurrent.f32(i32 154)
// CHECK: %[[WaveActiveOp:WaveActiveOp|[0-9]+]] = call float @dx.op.waveActiveOp.f32(i32 119, float %[[RayTCurrent]], i8 2, i8 0)

Просмотреть файл

@ -1,5 +1,5 @@
// RUN: %dxc -Zi -E main -T cs_6_0 %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHK_DB
// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHK_NODB
// RUN: %dxilver 1.6 | %dxc -Zi -E main -T cs_6_0 %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHK_DB
// RUN: %dxilver 1.6 | %dxc -E main -T cs_6_0 %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHK_NODB
// CHK_DB: 18:17: error: Assignment of undefined values to UAV.
// CHK_NODB: Function: main: error: Assignment of undefined values to UAV. Use /Zi for source location.

Просмотреть файл

@ -1379,7 +1379,8 @@ TEST_F(DxilContainerTest, CompileWhenOkThenCheckReflection1) {
}
TEST_F(DxilContainerTest, DxcUtils_CreateReflection) {
if (m_ver.SkipDxilVersion(1, 3)) return;
// Reflection stripping fails on DXIL.dll ver. < 1.5
if (m_ver.SkipDxilVersion(1, 5)) return;
CComPtr<IDxcUtils> pUtils;
VERIFY_SUCCEEDED(m_dllSupport.CreateInstance(CLSID_DxcUtils, &pUtils));

Просмотреть файл

@ -207,6 +207,7 @@ public:
TEST_METHOD(PixStructAnnotation_BigMess)
dxc::DxcDllSupport m_dllSupport;
VersionSupportInfo m_ver;
void CreateBlobPinned(_In_bytecount_(size) LPCVOID data, SIZE_T size,
UINT32 codePage, _Outptr_ IDxcBlobEncoding **ppBlob) {
@ -978,6 +979,7 @@ public:
bool PixTest::InitSupport() {
if (!m_dllSupport.IsEnabled()) {
VERIFY_SUCCEEDED(m_dllSupport.Initialize());
m_ver.Initialize(m_dllSupport);
}
return true;
}
@ -1899,6 +1901,8 @@ void PixTest::ValidateAllocaWrite(std::vector<AllocaWrite> const &allocaWrites,
TEST_F(PixTest, PixStructAnnotation_Simple) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -1928,6 +1932,8 @@ void main()
TEST_F(PixTest, PixStructAnnotation_CopiedStruct) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -1958,6 +1964,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_MixedSizes) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -1997,6 +2005,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_StructWithinStruct) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct Contained
@ -2039,6 +2049,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_1DArray) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char* hlsl = R"(
struct smallPayload
{
@ -2064,6 +2076,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_2DArray) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -2093,6 +2107,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_EmbeddedArray) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct Contained
@ -2136,6 +2152,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_FloatN) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -2167,6 +2185,8 @@ void main()
TEST_F(PixTest, PixStructAnnotation_SequentialFloatN) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -2204,6 +2224,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_EmbeddedFloatN) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct Embedded
@ -2244,6 +2266,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_Matrix) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct smallPayload
{
@ -2272,6 +2296,8 @@ void main()
}
TEST_F(PixTest, PixStructAnnotation_BigMess) {
if (m_ver.SkipDxilVersion(1, 5)) return;
const char *hlsl = R"(
struct BigStruct

Просмотреть файл

@ -1067,6 +1067,8 @@ TEST_F(ValidationTest, UpdateCounterFail) {
}
TEST_F(ValidationTest, LocalResCopy) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(
L"..\\DXILValidation\\resCopy.hlsl", "cs_6_0", {"ret void"},
{"%H = alloca %dx.types.ResRet.i32\n"
@ -1159,6 +1161,8 @@ TEST_F(ValidationTest, TypedUAVStoreFullMask1) {
}
TEST_F(ValidationTest, UAVStoreMaskMatch) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(
L"..\\CodeGenHLSL\\uav_store.hlsl", "ps_6_0",
"i32 2, i8 15)",
@ -1276,6 +1280,8 @@ TEST_F(ValidationTest, PullModelPosition) {
}
TEST_F(ValidationTest, StructBufGlobalCoherentAndCounter) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(
L"..\\DXILValidation\\struct_buf1.hlsl", "ps_6_0",
"!\"buf2\", i32 0, i32 0, i32 1, i32 12, i1 false, i1 false",
@ -1594,6 +1600,8 @@ TEST_F(ValidationTest, NoFunctionParam) {
}
TEST_F(ValidationTest, I8Type) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(L"..\\DXILValidation\\staticGlobals.hlsl", "ps_6_0",
"%([0-9]+) = alloca \\[4 x i32\\]",
"%\\1 = alloca [4 x i32]\n"
@ -2025,6 +2033,8 @@ float4 main(float4 col : COLOR, out uint coverage : SV_Coverage) : SV_Target7 {
}
TEST_F(ValidationTest, SemComponentOrder) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(" \
void main( \
float2 f2in : f2in, \
@ -2062,6 +2072,8 @@ void main( \
}
TEST_F(ValidationTest, SemComponentOrder2) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(" \
float4 main( \
float4 col : Color, \
@ -2088,6 +2100,8 @@ float4 main( \
}
TEST_F(ValidationTest, SemComponentOrder3) {
// error updated, so must exclude previous validator versions.
if (m_ver.SkipDxilVersion(1, 6)) return;
RewriteAssemblyCheckMsg(" \
float4 main( \
float4 col : Color, \

Просмотреть файл

@ -162,6 +162,9 @@ if "%1"=="-clean" (
) else if "%1"=="-file-check-dump" (
set ADDITIONAL_OPTS=%ADDITIONAL_OPTS% /p:"FileCheckDumpDir=%~2\HLSL"
shift /1
) else if "%1"=="-dxil-loc" (
set DXIL_DLL_LOC=%~2
shift /1
) else if "%1"=="--" (
shift /1
goto :done_opt
@ -246,6 +249,12 @@ if "%CUSTOM_BIN_SET%"=="" (
)
if errorlevel 1 exit /b 1
if not "%DXIL_DLL_LOC%"=="" (
echo Copying DXIL.dll to %TEST_DIR%:
call %HCT_DIR%\hctcopy.cmd %DXIL_DLL_LOC% %TEST_DIR% dxil.dll
if errorlevel 1 exit /b 1
)
rem Begin SPIRV change
if "%TEST_SPIRV%"=="1" (
if not exist %BIN_DIR%\clang-spirv-tests.exe (
@ -380,6 +389,7 @@ echo -adapter "adapter name" - overrides Adapter for execution tests
echo -verbose - for TAEF: turns off /parallel and removes logging filter
echo -custom-bin-set "file [file]..." - custom set of binaries to copy into test directory
echo -dxilconv-loc "dxilconv.dll location" - fetch dxilconv.dll from custom location
echo -dxil-loc "dxil.dll location" - fetch dxil.dll from provided location
echo -file-check-dump "dump-path" - dump file-check inputs to files under dump-path
echo.
echo current BUILD_ARCH=%BUILD_ARCH%. Override with:
@ -423,8 +433,8 @@ rem %2 - first argument to te
rem %3 - second argument to te
rem %4 - third argument to te
echo te /labMode /miniDumpOnCrash %LOG_FILTER% %PARALLEL_OPTION% %TEST_DIR%\%*
call te /labMode /miniDumpOnCrash %LOG_FILTER% %PARALLEL_OPTION% %TEST_DIR%\%*
echo te /labMode /miniDumpOnCrash /unicodeOutput:false /outputFolder:%TEST_DIR% %LOG_FILTER% %PARALLEL_OPTION% %TEST_DIR%\%*
call te /labMode /miniDumpOnCrash /unicodeOutput:false /outputFolder:%TEST_DIR% %LOG_FILTER% %PARALLEL_OPTION% %TEST_DIR%\%*
if errorlevel 1 (
call :showtesample %*