From 34a1ff5226a526cc17c5baecd63637f69c324fc7 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Sat, 22 May 2021 16:03:30 -0400 Subject: Improvements in -X support (#1852) * #include an absolute path didn't work - because paths were taken to always be relative. * Added SourceLoc handling for command line parsing. * Fix typo in debug. * Fix issue around the DiagnosticSink used in options parsing not having a writer available - by having DiagnosticSink parenting. * Small rename for clarity. * WIP extracting command line args for downstream tools. * Unit tests/bug fixes around extracting args. * Use DownstreamArgs in the EndToEndCompileRequest * Passing downstream compiler options downstream. * Fix issue with endToEndReq being nullptr. * Fix issue with diagnostics number change. * Small improvements to how the source line is displayed if it's too long. Default to 120, as suggested in previous review. * Make render test use x-args parsing and CommandArgReader. * Added missing diagnostics. * More DownstreamArgs to linkage so can be seen by 'components'. Added dxc-x-arg test. * Used combination of name and args instead of two Lists, which whilst equivalent was perhaps a little confusing. * Added documentation for -X support. * Added test for x-args parsing diagnostic. Improved diagnostic with list of known names. * Fix issues from merge. * Fix lookup for -matrix-layout-column-major in render test. * Remove commented out line. --- .../diagnostics/command-line/x-arg-tool-unknown.slang | 3 +++ .../command-line/x-arg-tool-unknown.slang.expected | 8 ++++++++ tests/downstream/dxc-x-arg.slang | 18 ++++++++++++++++++ tests/downstream/dxc-x-arg.slang.expected.txt | 4 ++++ 4 files changed, 33 insertions(+) create mode 100644 tests/diagnostics/command-line/x-arg-tool-unknown.slang create mode 100644 tests/diagnostics/command-line/x-arg-tool-unknown.slang.expected create mode 100644 tests/downstream/dxc-x-arg.slang create mode 100644 tests/downstream/dxc-x-arg.slang.expected.txt (limited to 'tests') diff --git a/tests/diagnostics/command-line/x-arg-tool-unknown.slang b/tests/diagnostics/command-line/x-arg-tool-unknown.slang new file mode 100644 index 000000000..cfcb09a12 --- /dev/null +++ b/tests/diagnostics/command-line/x-arg-tool-unknown.slang @@ -0,0 +1,3 @@ +// x-arg-tool-unknown.slang + +//DIAGNOSTIC_TEST:SIMPLE:-entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc -Xthingy diff --git a/tests/diagnostics/command-line/x-arg-tool-unknown.slang.expected b/tests/diagnostics/command-line/x-arg-tool-unknown.slang.expected new file mode 100644 index 000000000..73328c480 --- /dev/null +++ b/tests/diagnostics/command-line/x-arg-tool-unknown.slang.expected @@ -0,0 +1,8 @@ +result code = 1 +standard error = { +(1): error 100000: downstream tool name not known, allowed names are [ fxc, dxc, glslang, clang, visualstudio, gcc, genericcpp, nvrtc, downstream, linker ] +tests/diagnostics/command-line/x-arg-tool-unknown.slang -entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc -Xthingy + ^ +} +standard output = { +} diff --git a/tests/downstream/dxc-x-arg.slang b/tests/downstream/dxc-x-arg.slang new file mode 100644 index 000000000..93b24a7ad --- /dev/null +++ b/tests/downstream/dxc-x-arg.slang @@ -0,0 +1,18 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -compile-arg -O3 -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj +//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj + +// We are going to pass -Gis to DXC. +// Test can only work on DXC. +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -Xslang... -Xdxc -Gis -X. -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer + +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + outputBuffer[dispatchThreadID.x] = dispatchThreadID.x; +} \ No newline at end of file diff --git a/tests/downstream/dxc-x-arg.slang.expected.txt b/tests/downstream/dxc-x-arg.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/downstream/dxc-x-arg.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 -- cgit v1.2.3