From 79dd12c21e8f5c5ce01051a280679cf6ac8ffe97 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 26 Apr 2022 12:09:32 -0400 Subject: Linking in DXC (#2190) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> --- tests/library/library-test.slang | 7 +++---- tests/library/library-test.slang.expected.txt | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 tests/library/library-test.slang.expected.txt (limited to 'tests') diff --git a/tests/library/library-test.slang b/tests/library/library-test.slang index 143b1cbe1..3543ced10 100644 --- a/tests/library/library-test.slang +++ b/tests/library/library-test.slang @@ -6,12 +6,11 @@ // This didn't work for lib_6_2 when compiling via DXC (!). Even though it's stated elsewhere the feature is available from 6.1 //TEST:COMPILE: tests/library/library.slang -profile lib_6_3 -target dxil -o tests/library/library.dxil -//TEST:COMPILE: tests/library/library-test.slang -profile lib_6_3 -target dxil -o tests/library/library-test.dxil +//TEST:COMPILE: tests/library/library-test.slang -entry computeMain -profile cs_6_3 -target dxil -r tests/library/library.dxil -o tests/library/library-test.dxil -// It seems that I can't just compile the source containing the entry point/stage with the library/s. -// Instead I have to compile all the parts with lib profile, and then link together at the end. +// Test the produced kernel. -//DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -xslang -r -xslang tests/serialization/serialized-module.slang-module -shaderobj +//TEST:COMPARE_COMPUTE_EX:-slang -compute -profile cs_6_3 -dx12 -use-dxil -shaderobj -Xslang... -r tests/library/library.dxil -X. extern int foo(int a); diff --git a/tests/library/library-test.slang.expected.txt b/tests/library/library-test.slang.expected.txt new file mode 100644 index 000000000..c0e0beb96 --- /dev/null +++ b/tests/library/library-test.slang.expected.txt @@ -0,0 +1,4 @@ +6 +9 +E +15 -- cgit v1.2.3