I’m having problems with denoising buffers of certain sizes.
If I try to use the denoiser with an input buffer of 4000x3001 → 4000x3013 it crashes on 5.0.0 and causes an exception on 5.1.0
My tests show the problem on these ranges 4000x3001 → 4000x3013, 4000x3015 → 4000x3046, 4000x3048 → 4000x3127.
There’s lots of other sizes that cause the same issue.
Is there a max/min buffer size that the denoiser can handle reliably?
This is the simple test program I used :
#include <iostream>
#include "optix.h"
#include "optixu/optixpp_namespace.h"
const char* EMPTY_PROGRAM_PTX = {
"//\r\n"
"// Generated by NVIDIA NVVM Compiler\r\n"
"//\r\n"
"// Compiler Build ID: CL-23083092\r\n"
"// Cuda compilation tools, release 9.1, V9.1.85\r\n"
"// Based on LLVM 3.4svn\r\n"
"//\r\n"
"\r\n"
".version 6.1\r\n"
".target sm_30\r\n"
".address_size 64\r\n"
"\r\n"
" // .globl _Z12emptyProgramv\r\n"
".global .align 8 .u64 _ZN21rti_internal_register20reg_bitness_detectorE;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail0E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail1E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail2E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail3E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail4E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail5E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail6E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail7E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail8E;\r\n"
".global .align 8 .u64 _ZN21rti_internal_register24reg_exception_64_detail9E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail0E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail1E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail2E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail3E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail4E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail5E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail6E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail7E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail8E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register21reg_exception_detail9E;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register14reg_rayIndex_xE;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register14reg_rayIndex_yE;\r\n"
".global .align 4 .u32 _ZN21rti_internal_register14reg_rayIndex_zE;\r\n"
"\r\n"
".visible .entry _Z12emptyProgramv(\r\n"
"\r\n"
")\r\n"
"{\r\n"
"\r\n"
"\r\n"
"\r\n"
" ret;\r\n"
"}\r\n"
};
int main( int argc, char* argv[] )
{
// Get width and height from input params
if ( argc < 3 ) {
std::cout << "Parameters : denoisetest width height" << std::endl;
return 1;
}
RTsize width = atoi( argv[1] );
RTsize height = atoi( argv[2] );
try {
optix::Context context = optix::Context::create();
context->setRayTypeCount( 1 );
context->setEntryPointCount( 1 );
context->setStackSize( 1800 );
// Create empty program
optix::Program emptyProgram = context->createProgramFromPTXString( EMPTY_PROGRAM_PTX, "emptyProgram" );
context->setRayGenerationProgram( 0, emptyProgram );
optix::PostprocessingStage denoiserStage = context->createBuiltinPostProcessingStage( "DLDenoiser" );
denoiserStage->declareVariable( "blend" )->setFloat( 0.f );
// Create input and output buffers
optix::Buffer inputBuffer = context->createBuffer( RT_BUFFER_INPUT_OUTPUT, RT_FORMAT_FLOAT4, width, height );
optix::Buffer outputBuffer = context->createBuffer( RT_BUFFER_INPUT_OUTPUT, RT_FORMAT_FLOAT4, width, height );
// Set into denoiser
denoiserStage->declareVariable( "input_buffer" )->set( inputBuffer );
denoiserStage->declareVariable( "output_buffer" )->set( outputBuffer );
// Fill input buffer with black values
size_t numPixels = width * height;
float *dst = (float*)inputBuffer->map( 0, RT_BUFFER_MAP_WRITE_DISCARD );
for ( size_t i = 0; i < numPixels; ++i ) {
*dst++ = 0.f;
*dst++ = 0.f;
*dst++ = 0.f;
*dst++ = 1.f;
}
inputBuffer->unmap();
// Create command list, first append launch of 1, 1 was to combat bug in optix 5.0 when running denoiser
optix::CommandList commandList = context->createCommandList();
commandList->appendLaunch( 0, 1, 1 );
commandList->appendPostprocessingStage( denoiserStage, width, height );
commandList->finalize();
commandList->execute();
std::cout << width << "x" << height << " Denoise ok" << std::endl;
return 0;
}
catch ( const optix::Exception& ex ) {
std::cout << width << "x" << height << " Nvidia exception " << ex.getErrorString() << ", " << ex.getErrorCode() << std::endl;
}
catch ( ... ) {
std::cout << width << "x" << height << " Exception" << std::endl;
}
return 1;
}