From 9abcb6ea24dbc7184c3a2ad9f4458f63f8901928 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 18 Aug 2020 13:42:46 -0400 Subject: Support for float atomics on RWByteAddressBuffer (#1502) * Fix premake5.lua so it uses the new path needed for OpenCLDebugInfo100.h * Keep including the includes directory. * Added the spirv-tools-generated files. * We don't need to include the spirv/unified1 path because the files needed are actually in the spirv-tools-generated folder. * Put the build_info.h glslang generated files in external/glslang-generated. Alter premake5.lua to pick up that header. * First pass at documenting how to build glslang and spirv-tools. * Improved glsl/spir-v tools README.md * Added revision.h * Change how gResources is calculated. Update about revision.h * Update docs a little. * Split out spirv-tools into a separate project for building glslang. This was not necessary on linux, but *is* necessary on windows, because there is a file disassemble.cpp in spirv-tools and in glslang, and this leads to VS choosing only one. With the separate library, the problem is resolved. * Fix direct-spirv-emit output. * Update to latest version of spirv headers and spirv-tools. * Upgrade submodule version of glslang in external. * Add fPIC to build options of slang-spirv-tools * WIP adding support for InterlockedAddFp32 * Upgrade slang-binaries to have new glslang. * Fix issues with Windows slang-glslang binaries, via update of slang-binaries used. * WIP - atomicAdd. This solution can't work as we can't do (float*) in glsl. * WIP on atomic float ops. * Added checking for multiple decls that takes into account __target_intrinsic and __specialized_for_target. First pass impl of atomic add on float for glsl. * Split __atomicAdd so extensions are applied appropriately. * Made Dxc/Fxc support includes. Use HLSL prelude to pass the path to nvapi Added -nv-api-path * Refactor around IncludeHandler and impl of IncludeSystem * slang-include-handler -> slang-include-system Have IncludeHandler/Impl defined in slang-preprocessor * Small comment improvements. * Document atomic float add addition in target-compatibility.md. * CUDA float atomic support on RWByteAddressBuffer. * Add atomic-float-byte-address-buffer-cross.slang * Removed inappropriate-once.slang - the test is no longer valid when a file is loaded and has a unique identity by default. A test could be made, but would require an API call to create the file (so no unique id). Improved handling of loadFile - uses uniqueId if has one. * Work around for testing target overlaps - to avoid exceptions on adding targets. Simplify PathInfo setup. Modify single-target-intrinsic.slang - it no longer failed because there were no longer multiple definitions for the same target. Co-authored-by: Tim Foley --- tools/slang-test/options.cpp | 10 ++++++++++ tools/slang-test/options.h | 2 ++ tools/slang-test/slang-test-main.cpp | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index 27b759a0e..875f9ef0b 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -266,6 +266,16 @@ static bool _isSubCommand(const char* arg) return res; } } + else if (strcmp(arg, "-nv-api-path") == 0) + { + if (argCursor == argEnd) + { + stdError.print("error: expected operand for '%s'\n", arg); + return SLANG_FAIL; + } + + optionsOut->nvAPIPath = *argCursor++; + } else { stdError.print("unknown option '%s'\n", arg); diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h index a8c2e3852..ddd905e64 100644 --- a/tools/slang-test/options.h +++ b/tools/slang-test/options.h @@ -98,6 +98,8 @@ struct Options // The adapter to use. If empty will match first found adapter. Slang::String adapter; + Slang::String nvAPIPath; + /// Parse the args, report any errors into stdError, and write the results into optionsOut static SlangResult parse(int argc, char** argv, TestCategorySet* categorySet, Slang::WriterHelper stdError, Options* optionsOut); }; diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 9ef013aad..c6562ed86 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -3191,8 +3191,6 @@ SlangResult innerMain(int argc, char** argv) TestContext context; SLANG_RETURN_ON_FAIL(SLANG_FAILED(context.init())) - TestToolUtil::setSessionDefaultPrelude(argv[0], context.getSession()); - auto& categorySet = context.categorySet; // Set up our test categories here @@ -3272,6 +3270,19 @@ SlangResult innerMain(int argc, char** argv) Options& options = context.options; + // Set up the prelude + { + TestToolUtil::PreludeInfo info; + info.exePath = argv[0]; + + if (options.nvAPIPath.getLength()) + { + info.nvAPIPath = options.nvAPIPath.getBuffer(); + } + + TestToolUtil::setSessionDefaultPrelude(info, context.getSession()); + } + if (options.outputMode == TestOutputMode::TeamCity) { // On TeamCity CI there is an issue with unix/linux targets where test system may be different from the build system -- cgit v1.2.3