summaryrefslogtreecommitdiff
path: root/tools/slang-test
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-18 11:40:59 -0400
committerGitHub <noreply@github.com>2019-09-18 11:40:59 -0400
commit31c7abcc27a33d63ac8d335387a0ce7b3ad74954 (patch)
tree3b4254df7bdbf8b497aa8a3e5f08f8927c1afbc6 /tools/slang-test
parent3af404da7f7f125464b78159940cb3fc06e69cc5 (diff)
Improvements to testing and ABI for CPU (#1057)
* WIP: Improving CPU performance/ABI * Optionally output code on CPU for groupThreadID and groupID. * Added ability to set compute dispatch size on command line for render-test. Dispatch compute tests taking into account dispatch size. Added test for semantics are working. * Test using GroupRange. * Fix problem with adding \n for externa diagnostic - to do it if there isn't a \n at the end. Change the ouput order (put result before) so last value is diagnostic string. * Made GroupRange the default exposed CPU ABI entry point style. Removed CPU_EXECUTE test style -as tested via the now cross platform render-test * Split out execution from setup for execution to improve perf. * For better code coverage/testing test all styles of CPU compute entry point. * Improve documentation for ABI changes for CPU code. Add 'expecting' to error message from review. * Fix small typos.
Diffstat (limited to 'tools/slang-test')
-rw-r--r--tools/slang-test/slang-test-main.cpp115
1 files changed, 0 insertions, 115 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 26d611181..a2d24a54f 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1109,120 +1109,6 @@ static SlangResult _loadAsSharedLibrary(const UnownedStringSlice& hexDump, Tempo
return SharedLibrary::loadWithPlatformPath(sharedLibraryName.getBuffer(), outSharedLibrary);
}
-static void _writeBuffer(const CPPPrelude::RWStructuredBuffer<int32_t>& in, StringBuilder& out)
-{
- for (size_t i = 0; i < in.count; ++i)
- {
- if (i > 0)
- {
- out << ", ";
- }
- out << in[i];
- }
- out << "\n";
-}
-
-TestResult runCPUExecuteTest(TestContext* context, TestInput& input)
-{
- auto outputStem = input.outputStem;
-
- CommandLine cmdLine;
- _initSlangCompiler(context, cmdLine);
-
- cmdLine.addArg(input.filePath);
-
- for (auto arg : input.testOptions->args)
- {
- cmdLine.addArg(arg);
- }
-
- ExecuteResult exeRes;
- TEST_RETURN_ON_DONE(spawnAndWait(context, outputStem, input.spawnType, cmdLine, exeRes));
-
- if (context->isCollectingRequirements())
- {
- return TestResult::Pass;
- }
-
- TemporaryFileSet temporaryFileSet;
- SharedLibrary::Handle sharedLibrary = SharedLibrary::Handle(0);
- if (SLANG_FAILED(_loadAsSharedLibrary(exeRes.standardOutput.getUnownedSlice(), temporaryFileSet, sharedLibrary)))
- {
- return TestResult::Fail;
- }
-
- StringBuilder actualOutput;
-
- // TODO(JS): For moment just assume function name/data/parameters
- {
- SharedLibrary::FuncPtr func = SharedLibrary::findFuncByName(sharedLibrary, "computeMain");
- if (!func)
- {
- SharedLibrary::unload(sharedLibrary);
- return TestResult::Fail;
- }
-
-
- struct UniformState
- {
- CPPPrelude::RWStructuredBuffer<int> buffer;
- };
-
- typedef void (*Func)(CPPPrelude::ComputeVaryingInput* varyingInput, CPPPrelude::UniformEntryPointParams* params, UniformState* uniformState);
-
- Func runFunc = Func(func);
- int32_t data[4] = { 0, 0, 0, 0};
-
- UniformState state;
-
- state.buffer = CPPPrelude::RWStructuredBuffer<int32_t>{data, 4};
-
- CPPPrelude::ComputeVaryingInput varyingInput = {};
- for (Int i = 0; i < 4; ++i)
- {
- varyingInput.groupThreadID.x = uint32_t(i);
- runFunc(&varyingInput, nullptr, &state);
- }
-
- SharedLibrary::unload(sharedLibrary);
-
- // Write the data
- _writeBuffer(state.buffer, actualOutput);
- }
-
- String expectedOutputPath = outputStem + ".expected";
- String expectedOutput;
- try
- {
- expectedOutput = Slang::File::readAllText(expectedOutputPath);
- }
- catch (Slang::IOException)
- {
- }
-
- TestResult result = TestResult::Pass;
-
- // Otherwise we compare to the expected output
- if (actualOutput != expectedOutput)
- {
- context->reporter->dumpOutputDifference(expectedOutput, actualOutput);
- result = TestResult::Fail;
- }
-
- // If the test failed, then we write the actual output to a file
- // so that we can easily diff it from the command line and
- // diagnose the problem.
- if (result == TestResult::Fail)
- {
- String actualOutputPath = outputStem + ".actual";
- Slang::File::writeAllText(actualOutputPath, actualOutput);
-
- context->reporter->dumpOutputDifference(expectedOutput, actualOutput);
- }
-
- return result;
-}
-
TestResult runSimpleCompareCommandLineTest(TestContext* context, TestInput& input)
{
TestInput workInput(input);
@@ -2456,7 +2342,6 @@ static const TestCommandInfo s_testCommandInfos[] =
{ "CPP_COMPILER_EXECUTE", &runCPPCompilerExecute},
{ "CPP_COMPILER_SHARED_LIBRARY", &runCPPCompilerSharedLibrary},
{ "CPP_COMPILER_COMPILE", &runCPPCompilerCompile},
- { "CPU_EXECUTE", &runCPUExecuteTest},
};
TestResult runTest(