From 31c7abcc27a33d63ac8d335387a0ce7b3ad74954 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 18 Sep 2019 11:40:59 -0400 Subject: 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. --- tools/render-test/cpu-compute-util.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'tools/render-test/cpu-compute-util.h') diff --git a/tools/render-test/cpu-compute-util.h b/tools/render-test/cpu-compute-util.h index b30ef146b..1284735c0 100644 --- a/tools/render-test/cpu-compute-util.h +++ b/tools/render-test/cpu-compute-util.h @@ -11,6 +11,14 @@ namespace renderer_test { struct CPUComputeUtil { + enum class ExecuteStyle + { + Unknown, + Thread, + Group, + GroupRange, + }; + struct Resource : public RefObject { void* getInterface() const { return m_interface; } @@ -27,9 +35,28 @@ struct CPUComputeUtil List > m_resources; }; + struct ExecuteInfo + { + typedef void (*Func)(); + + ExecuteStyle m_style; + Func m_func; + uint32_t m_dispatchSize[3]; + uint32_t m_numThreadsPerAxis[3]; + + void* m_uniformState; + void* m_uniformEntryPointParams; + }; + + + /// Runs code across run styles and makes sure output buffers match + static SlangResult checkStyleConsistency(const uint32_t dispatchSize[3], const ShaderCompilerUtil::OutputAndLayout& compilationAndLayout); + static SlangResult calcBindings(const ShaderCompilerUtil::OutputAndLayout& compilationAndLayout, Context& outContext); - static SlangResult execute(const uint32_t dispatchSize[3], const ShaderCompilerUtil::OutputAndLayout& compilationAndLayout, Context& outContext); + static SlangResult calcExecuteInfo(ExecuteStyle style, const uint32_t dispatchSize[3], const ShaderCompilerUtil::OutputAndLayout& compilationAndLayout, Context& context, ExecuteInfo& out); + + static SlangResult execute(const ExecuteInfo& info); static SlangResult writeBindings(const ShaderInputLayout& layout, const List& buffers, const Slang::String& fileName); }; -- cgit v1.2.3