Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code for PR #6253 #11

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/slang/slang-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ SlangResult CodeGenContext::emitWithDownstreamForEntryPoints(ComPtr<IArtifact>&
}
}
}
//HERE
// HERE
}
});

Expand Down
13 changes: 6 additions & 7 deletions tools/gfx-unit-test/precompiled-module-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void precompiledModule2TestImplCommon(
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

const int numberCount = 4;
float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f};
IBufferResource::Desc bufferDesc = {};
Expand All @@ -199,13 +199,13 @@ void precompiledModule2TestImplCommon(
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

GFX_CHECK_CALL_ABORT(
device->createBufferResource(bufferDesc, (void*)initialData, numbersBuffer.writeRef()));
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

ComPtr<IResourceView> bufferView;
IResourceView::Desc viewDesc = {};
viewDesc.type = IResourceView::Type::UnorderedAccess;
Expand All @@ -215,7 +215,7 @@ void precompiledModule2TestImplCommon(
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

// We have done all the set up work, now it is time to start recording a command buffer for
// GPU execution.
{
Expand All @@ -241,7 +241,7 @@ void precompiledModule2TestImplCommon(
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

compareComputeResult(device, numbersBuffer, Slang::makeArray<float>(3.0f, 3.0f, 3.0f, 3.0f));
printf("File, Line: %s, %d\n", __FILE__, __LINE__);
fflush(stdout);
Expand Down Expand Up @@ -298,15 +298,14 @@ SLANG_UNIT_TEST(precompiledTargetModule2Vulkan)
}
catch (const std::exception&)
{
printf("Caught exception\n");
printf("Caught exception\n");
fflush(stdout);
}
catch (...)
{
printf("Caught unknown exception\n");
fflush(stdout);
}

}

} // namespace gfx_test
4 changes: 2 additions & 2 deletions tools/gfx/renderer-shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,8 +1184,8 @@ Result ShaderProgramBase::compileShaders(RendererBase* device)
{
ComPtr<slang::IBlob> diagnosticsBlob;
auto result = precompileService->getPrecompiledTargetCode(
compileTarget,
downstreamIR.writeRef(),
compileTarget,
downstreamIR.writeRef(),
diagnosticsBlob.writeRef());
if (result == SLANG_OK)
{
Expand Down
14 changes: 7 additions & 7 deletions tools/gfx/vulkan/vk-shader-program.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// vk-shader-program.cpp
#include "vk-shader-program.h"

#include "external/spirv-tools/include/spirv-tools/linker.hpp"
#include "vk-device.h"
#include "vk-util.h"

#include "external/spirv-tools/include/spirv-tools/linker.hpp"

namespace gfx
{

Expand Down Expand Up @@ -71,14 +70,14 @@ VkPipelineShaderStageCreateInfo ShaderProgramImpl::compileEntryPoint(
return shaderStageCreateInfo;
}

static ComPtr<ISlangBlob> LinkUsingSPIRVTools(List<ComPtr<ISlangBlob> > kernelCodes)
static ComPtr<ISlangBlob> LinkUsingSPIRVTools(List<ComPtr<ISlangBlob>> kernelCodes)
{
spvtools::Context context(SPV_ENV_UNIVERSAL_1_5);
spvtools::LinkerOptions options;
spvtools::MessageConsumer consumer = [](spv_message_level_t level,
const char* source,
const spv_position_t& position,
const char* message)
const char* source,
const spv_position_t& position,
const char* message)
{
printf("SPIRV-TOOLS: %s\n", message);
printf("SPIRV-TOOLS: %s\n", source);
Expand Down Expand Up @@ -108,7 +107,8 @@ static ComPtr<ISlangBlob> LinkUsingSPIRVTools(List<ComPtr<ISlangBlob> > kernelCo

// Replace kernel code with linked binary
// Creates a new blob with the linked binary
linkedKernelCode = RawBlob::create(linked_binary.data(), linked_binary.size() * sizeof(uint32_t));
linkedKernelCode =
RawBlob::create(linked_binary.data(), linked_binary.size() * sizeof(uint32_t));

return linkedKernelCode;
}
Expand Down
49 changes: 25 additions & 24 deletions tools/slang-test/slang-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2684,7 +2684,7 @@ static TestResult runCPPCompilerSharedLibrary(TestContext* context, TestInput& i
{
printf("Unable to access 'test' function\n");
}

printf("Unload handle\n");
fflush(stdout);
SharedLibrary::unload(handle);
Expand Down Expand Up @@ -4555,12 +4555,16 @@ static SlangResult runUnitTestModule(
SLANG_RETURN_ON_FAIL(loader->loadSharedLibrary(
Path::combine(context->dllDirectoryPath, moduleName).getBuffer(),
moduleLibrary.writeRef()));
printf("FILE LINE: %s %d\n", __FILE__, __LINE__); fflush(stdout); fflush(stderr);
printf("FILE LINE: %s %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);
UnitTestGetModuleFunc getModuleFunc =
(UnitTestGetModuleFunc)moduleLibrary->findFuncByName("slangUnitTestGetModule");
if (!getModuleFunc)
return SLANG_FAIL;
printf("FILE LINE: %s %d\n", __FILE__, __LINE__); fflush(stdout); fflush(stderr);
printf("FILE LINE: %s %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

IUnitTestModule* testModule = getModuleFunc();
if (!testModule)
Expand Down Expand Up @@ -4637,7 +4641,7 @@ static SlangResult runUnitTestModule(
printf("2RPC FILE LINE: %s %d\n", __FILE__, __LINE__);
const auto testResult = _asTestResult(ToolReturnCode(exeRes.resultCode));
printf("2RPC FILE LINE: %s %d\n", __FILE__, __LINE__);

// If the test fails, output any output - which might give information about
// individual tests that have failed.
if (SLANG_FAILED(rpcRes) || testResult == TestResult::Fail)
Expand All @@ -4663,13 +4667,12 @@ static SlangResult runUnitTestModule(
fflush(stderr);
printf("TF FILE LINE: %s %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);
fflush(stderr);
test.testFunc(&unitTestContext);
printf("TF2 FILE LINE: %s %d\n", __FILE__, __LINE__);
printf("FILE LINE: %s %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

}
catch (...)
{
Expand Down Expand Up @@ -4712,7 +4715,6 @@ static SlangResult runUnitTestModule(
printf("B Ran unit test file %s line %d\n", __FILE__, __LINE__);
fflush(stdout);
fflush(stderr);

}
}

Expand Down Expand Up @@ -4775,7 +4777,7 @@ SlangResult innerMain(int argc, char** argv)
{
SlangSession* session = context.getSession();


out.print("Supported backends:");

for (int i = 0; i < SLANG_PASS_THROUGH_COUNT_OF; ++i)
Expand Down Expand Up @@ -4818,7 +4820,7 @@ SlangResult innerMain(int argc, char** argv)
SLANG_CPP_SOURCE,
SLANG_SHADER_HOST_CALLABLE);
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

if (hasLlvm && hostCallableCompiler == SLANG_PASS_THROUGH_LLVM && SLANG_PROCESSOR_X86)
{
// TODO(JS)
Expand All @@ -4831,10 +4833,9 @@ SlangResult innerMain(int argc, char** argv)
categorySet.add("war-double-host-callable", fullTestCategory);
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Working out what renderApis is worked on on demand through
// _getAvailableRenderApiFlags()

Expand All @@ -4843,21 +4844,21 @@ SlangResult innerMain(int argc, char** argv)
context.setInnerMainFunc("slangc", &SlangCTool::innerMain);
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

SLANG_RETURN_ON_FAIL(
Options::parse(argc, argv, &categorySet, StdWriters::getError(), &context.options));
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

Options& options = context.options;
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

context.setMaxTestRunnerThreadCount(options.serverCount);
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Set up the prelude/s
TestToolUtil::setSessionDefaultPreludeFromExePath(argv[0], context.getSession());
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

if (options.outputMode == TestOutputMode::TeamCity)
{
// On TeamCity CI there is an issue with unix/linux targets where test system may be
Expand All @@ -4876,11 +4877,11 @@ SlangResult innerMain(int argc, char** argv)
_disableD3D12Backend(&context);
#endif
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

if (options.subCommand.getLength())
{
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Get the function from the tool
auto func = context.getInnerMainFunc(options.binDir, options.subCommand);
if (!func)
Expand All @@ -4907,20 +4908,20 @@ SlangResult innerMain(int argc, char** argv)
args.getBuffer());
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

if (options.includeCategories.getCount() == 0)
{
options.includeCategories.add(fullTestCategory, fullTestCategory);
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Don't include OptiX tests unless the client has explicit opted into them.
if (!options.includeCategories.containsKey(optixTestCategory))
{
options.excludeCategories.add(optixTestCategory, optixTestCategory);
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Exclude rendering tests when building under AppVeyor.
//
// TODO: this is very ad hoc, and we should do something cleaner.
Expand All @@ -4947,7 +4948,7 @@ SlangResult innerMain(int argc, char** argv)
runTestsInDirectory(&context);
}
out.print("FILE LINE: %s %d\n", __FILE__, __LINE__);

// Run the unit tests (these are internal C++ tests - not specified via files in a
// directory) They are registered with SLANG_UNIT_TEST macro
//
Expand Down Expand Up @@ -4987,7 +4988,7 @@ SlangResult innerMain(int argc, char** argv)
TestReporter::set(nullptr);
}
out.print("4941 FILE LINE: %s %d\n", __FILE__, __LINE__);

// If we have a couple failed tests, they maybe intermittent failures due to parallel
// excution or driver instability. We can try running them again.
static constexpr int kFailedTestLimitForRetry = 16;
Expand Down Expand Up @@ -5021,7 +5022,7 @@ SlangResult innerMain(int argc, char** argv)
}
}
out.print("4975 FILE LINE: %s %d\n", __FILE__, __LINE__);

reporter.outputSummary();
return reporter.didAllSucceed() ? SLANG_OK : SLANG_FAIL;
}
Expand Down
Loading