Skip to content
Open
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
39 changes: 38 additions & 1 deletion 28_FFTBloom/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ class FFTBloomApp final : public SimpleWindowedApplication, public BuiltinResour
FFTBloomApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD) :
system::IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}

virtual SPhysicalDeviceFeatures getPreferredDeviceFeatures() const override
{
auto retval = device_base_t::getPreferredDeviceFeatures();
retval.pipelineExecutableInfo = true;
return retval;
}

bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) override
{
// Remember to call the base class initialization!
Expand Down Expand Up @@ -730,12 +737,27 @@ class FFTBloomApp final : public SimpleWindowedApplication, public BuiltinResour
// Normalization doesn't require full subgroups
params[i].cached.requireFullSubgroups = bool(2-i);
params[i].shader.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(hlsl::findMSB(deviceLimits.maxSubgroupSize));
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params[i].flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params[i].flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
}

smart_refctd_ptr<IGPUComputePipeline> pipelines[3];
if(!m_device->createComputePipelines(nullptr, { params, 3 }, pipelines))
return logFail("Failed to create Compute Pipelines!\n");

if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
const char* kernelNames[] = {"Kernel First Axis FFT", "Kernel Second Axis FFT", "Kernel Spectrum Normalize"};
for (auto i = 0u; i < 3; i++)
{
auto report = system::to_string(pipelines[i]->getExecutableInfo());
m_logger->log("%s Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, kernelNames[i], report.c_str());
}
}

// Push Constants - only need to specify BDAs here
PushConstantData pushConstants;
pushConstants.colMajorBufferAddress = m_colMajorBufferAddress[0];
Expand Down Expand Up @@ -933,12 +955,27 @@ class FFTBloomApp final : public SimpleWindowedApplication, public BuiltinResour
params[i].shader.entryPoint = "main";
params[i].shader.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(hlsl::findMSB(deviceLimits.maxSubgroupSize));
params[i].cached.requireFullSubgroups = true;
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params[i].flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params[i].flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
}

smart_refctd_ptr<IGPUComputePipeline> pipelines[3];
if (!m_device->createComputePipelines(nullptr, { params, 3 }, pipelines))
return logFail("Failed to create Compute Pipelines!\n");

if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
const char* imageNames[] = {"Image First Axis FFT", "FFT Convolve IFFT", "Image First Axis IFFT"};
for (auto i = 0u; i < 3; i++)
{
auto report = system::to_string(pipelines[i]->getExecutableInfo());
m_logger->log("%s Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, imageNames[i], report.c_str());
}
}

m_firstAxisFFTPipeline = pipelines[0];
m_lastAxisFFT_convolution_lastAxisIFFTPipeline = pipelines[1];
m_firstAxisIFFTPipeline = pipelines[2];
Expand Down
18 changes: 18 additions & 0 deletions 29_Arithmetic2Bench/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
ArithmeticBenchApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD) :
system::IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}

virtual SPhysicalDeviceFeatures getPreferredDeviceFeatures() const override
{
auto retval = device_base_t::getPreferredDeviceFeatures();
retval.pipelineExecutableInfo = true;
return retval;
}

inline core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces() const override
{
if (!m_surface)
Expand Down Expand Up @@ -508,9 +515,20 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
.entries = nullptr,
};
params.cached.requireFullSubgroups = true;
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
core::smart_refctd_ptr<IGPUComputePipeline> pipeline;
if (!m_device->createComputePipelines(nullptr,{&params,1},&pipeline))
return nullptr;

if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(pipeline->getExecutableInfo());
m_logger->log("Arithmetic Bench Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, report.c_str());
}
return pipeline;
}

Expand Down
23 changes: 21 additions & 2 deletions 30_ComputeShaderPathTracer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class ComputeShaderPathtracer final : public SimpleWindowedApplication, public B

inline bool isComputeOnly() const override { return false; }

virtual SPhysicalDeviceFeatures getPreferredDeviceFeatures() const override
{
auto retval = device_base_t::getPreferredDeviceFeatures();
retval.pipelineExecutableInfo = true;
return retval;
}

inline core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces() const override
{
if (!m_surface)
Expand Down Expand Up @@ -361,9 +368,21 @@ class ComputeShaderPathtracer final : public SimpleWindowedApplication, public B
params.shader.entries = nullptr;
params.cached.requireFullSubgroups = true;
params.shader.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(5);
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}

if (!m_device->createComputePipelines(nullptr, { &params, 1 }, m_PTPipelines.data() + index)) {
return logFail("Failed to create compute pipeline!\n");
}

if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(m_PTPipelines[index]->getExecutableInfo());
m_logger->log("%s Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, PTShaderPaths[index].c_str(), report.c_str());
}
}
}

Expand Down Expand Up @@ -500,7 +519,7 @@ class ComputeShaderPathtracer final : public SimpleWindowedApplication, public B
m_logger->log("Couldn't load an asset.", ILogger::ELL_ERROR);
std::exit(-1);
}
};
}
{
asset::ICPUImage::SCreationParams info;
info.format = asset::E_FORMAT::EF_R32G32_UINT;
Expand Down Expand Up @@ -1282,4 +1301,4 @@ class ComputeShaderPathtracer final : public SimpleWindowedApplication, public B
IGPUCommandBuffer::SClearColorValue clearColor = { .float32 = {0.f,0.f,0.f,1.f} };
};

NBL_MAIN_FUNC(ComputeShaderPathtracer)
NBL_MAIN_FUNC(ComputeShaderPathtracer)
29 changes: 29 additions & 0 deletions 64_EmulatedFloatTest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class CompatibilityTest final : public MonoDeviceApplication, public BuiltinReso
CompatibilityTest(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD) :
IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}

virtual SPhysicalDeviceFeatures getPreferredDeviceFeatures() const override
{
auto retval = device_base_t::getPreferredDeviceFeatures();
retval.pipelineExecutableInfo = true;
return retval;
}

bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) override
{
// since emulated_float64_t rounds to zero
Expand Down Expand Up @@ -317,8 +324,19 @@ class CompatibilityTest final : public MonoDeviceApplication, public BuiltinReso
params.layout = m_pplnLayout.get();
params.shader.entryPoint = "main";
params.shader.shader = shader.get();
if (base.m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
if (!base.m_device->createComputePipelines(nullptr, { &params,1 }, &m_pipeline))
base.logFail("Failed to create pipelines (compile & link shaders)!\n");

if (base.m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(m_pipeline->getExecutableInfo());
base.m_logger->log("EF64Submitter Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, report.c_str());
}
}

// Allocate the memory
Expand Down Expand Up @@ -975,8 +993,19 @@ class CompatibilityTest final : public MonoDeviceApplication, public BuiltinReso
params.layout = m_pplnLayout.get();
params.shader.entryPoint = "main";
params.shader.shader = shader.get();
if (base.m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
if (!base.m_device->createComputePipelines(nullptr, { &params,1 }, &m_pipeline))
base.logFail("Failed to create pipelines (compile & link shaders)!\n");

if (base.m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(m_pipeline->getExecutableInfo());
base.m_logger->log("EF64Benchmark Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, report.c_str());
}
}

// Allocate the memory
Expand Down
45 changes: 42 additions & 3 deletions 70_FLIPFluids/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ class FLIPFluidsApp final : public SimpleWindowedApplication, public BuiltinReso
inline FLIPFluidsApp(const path& _localInputCWD, const path& _localOutputCWD, const path& _sharedInputCWD, const path& _sharedOutputCWD)
: IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}

inline SPhysicalDeviceFeatures getPreferredDeviceFeatures() const override
{
auto retval = device_base_t::getPreferredDeviceFeatures();
retval.pipelineExecutableInfo = true;
return retval;
}

inline core::vector<video::SPhysicalDeviceFilter::SurfaceCompatibility> getSurfaces() const override
{
if (!m_surface)
Expand Down Expand Up @@ -374,8 +381,18 @@ class FLIPFluidsApp final : public SimpleWindowedApplication, public BuiltinReso
params.layout = pipelineLayout.get();
params.shader.entryPoint = entryPoint;
params.shader.shader = shader.get();

if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
m_device->createComputePipelines(nullptr, { &params,1 }, &pipeline);

if (m_device->getEnabledFeatures().pipelineExecutableInfo && pipeline)
{
auto report = system::to_string(pipeline->getExecutableInfo());
m_logger->log("%s Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, ShaderKey.value, report.c_str());
}
};

{
Expand Down Expand Up @@ -627,16 +644,38 @@ class FLIPFluidsApp final : public SimpleWindowedApplication, public BuiltinReso
params.layout = pipelineLayout.get();
params.shader.entryPoint = "iterateDiffusion";
params.shader.shader = diffusion.get();
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &m_iterateDiffusionPipeline))
m_logger->log("Failed to create iterateDiffusion pipeline!\n");

m_device->createComputePipelines(nullptr, { &params,1 }, &m_iterateDiffusionPipeline);
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(m_iterateDiffusionPipeline->getExecutableInfo());
m_logger->log("iterateDiffusion Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, report.c_str());
}
}
{
IGPUComputePipeline::SCreationParams params = {};
params.layout = pipelineLayout.get();
params.shader.entryPoint = "applyDiffusion";
params.shader.shader = diffusion.get();
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS;
params.flags |= IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS;
}
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &m_diffusionPipeline))
m_logger->log("Failed to create applyDiffusion pipeline!\n");

m_device->createComputePipelines(nullptr, { &params,1 }, &m_diffusionPipeline);
if (m_device->getEnabledFeatures().pipelineExecutableInfo)
{
auto report = system::to_string(m_diffusionPipeline->getExecutableInfo());
m_logger->log("applyDiffusion Pipeline Executable Report:\n%s", ILogger::ELL_PERFORMANCE, report.c_str());
}
}

{
Expand Down
Loading