Skip to content

Commit

Permalink
Avoid using the backend validation when using test server (#6094)
Browse files Browse the repository at this point in the history
* Avoid using the backend validation when using test server

Currently with a debug build, the backend validation such
as Vulkan-Validation-Layer or DXC validation is enabled all the time.
It means there is a higher chance that we see warning messages while
running slang-test with a debug build.

However, those warning messages incorrectly treated as the testing
result when using test-server. This is mainly because of the fact that
the Slang implemention for the RPC commucation expects only one time
output result. As soon as any warning is printed, the testing process is
incorrectly considered as completed even though it might be still in the
middle of initializing the device.

This commit disables the backend validation when using the test-server.

* format code (#31)

Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>

---------

Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
  • Loading branch information
4 people authored Jan 17, 2025
1 parent ddc4a17 commit f68d493
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/render-test/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ static rhi::DeviceType _toRenderType(Slang::RenderApiType apiType)
{
SLANG_RETURN_ON_FAIL(reader.expectArg(outOptions.entryPointName));
}
else if (argValue == "-enable-backend-validation")
{
outOptions.enableBackendValidation = true;
}
else
{
// Lookup
Expand Down
2 changes: 2 additions & 0 deletions tools/render-test/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ struct Options

bool generateSPIRVDirectly = true;

bool enableBackendValidation = false;

Options() { downstreamArgs.addName("slang"); }

static SlangResult parse(
Expand Down
4 changes: 3 additions & 1 deletion tools/render-test/render-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,10 +1367,12 @@ static SlangResult _innerMain(

#if _DEBUG
desc.enableValidation = true;
desc.enableBackendValidation = true;
desc.debugCallback = &debugCallback;
#endif

if (options.enableBackendValidation)
desc.enableBackendValidation = true;

desc.slang.lineDirectiveMode = SLANG_LINE_DIRECTIVE_MODE_NONE;
if (options.generateSPIRVDirectly)
desc.slang.targetFlags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY;
Expand Down
9 changes: 9 additions & 0 deletions tools/slang-test/slang-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3478,6 +3478,15 @@ TestResult runComputeComparisonImpl(
auto actualOutputFile = outputStem + ".actual.txt";
cmdLine.addArg(actualOutputFile);

#if _DEBUG
// When using test server, any validation warning printed from the backend
// gets misinterpreted as the result from the test.
// This is due to the limitation that Slang RPC implementation expects only
// one time communication.
if (input.spawnType != SpawnType::UseTestServer)
cmdLine.addArg("-enable-backend-validation");
#endif

if (context->isExecuting())
{
// clear the stale actual output file first. This will allow us to detect error if
Expand Down

0 comments on commit f68d493

Please sign in to comment.