99#include " op.h"
1010#include " util.h"
1111
12- #define ENABLE_OPTIX_VALIDATION_MODE 0
12+ #if !defined(NDEBUG) || defined(DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION)
13+ #define DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
14+ #endif
1315
1416#define jitc_optix_check (err ) jitc_optix_check_impl((err), __FILE__, __LINE__)
1517extern void jitc_optix_check_impl (OptixResult errval, const char *file, const int line);
@@ -37,7 +39,7 @@ static OptixPipelineCompileOptions jitc_optix_default_compile_options() {
3739 pco.numAttributeValues = 2 ;
3840 pco.pipelineLaunchParamsVariableName = " params" ;
3941
40- #if defined(NDEBUG)
42+ #ifndef DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
4143 pco.exceptionFlags = OPTIX_EXCEPTION_FLAG_NONE;
4244#else
4345 pco.exceptionFlags = OPTIX_EXCEPTION_FLAG_DEBUG |
@@ -58,7 +60,7 @@ OptixDeviceContext jitc_optix_context() {
5860
5961 OptixDeviceContextOptions ctx_opts {
6062 jitc_optix_log, nullptr , 4 ,
61- #if defined(NDEBUG) || !ENABLE_OPTIX_VALIDATION_MODE
63+ #ifndef DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
6264 OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_OFF
6365#else
6466 OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL
@@ -85,11 +87,11 @@ OptixDeviceContext jitc_optix_context() {
8587 if (!state.optix_default_sbt_index ) {
8688 OptixPipelineCompileOptions pco = jitc_optix_default_compile_options ();
8789 OptixModuleCompileOptions mco { };
88- #if 1
90+ #ifndef DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
8991 mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
9092 mco.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
9193#else
92- mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_MINIMAL ;
94+ mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL ;
9395 mco.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
9496#endif
9597
@@ -239,11 +241,11 @@ bool jitc_optix_compile(ThreadState *ts, const char *buf, size_t buf_size,
239241 // =====================================================
240242
241243 OptixModuleCompileOptions mco { };
242- #if 1
244+ #ifndef DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
243245 mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
244246 mco.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
245247#else
246- mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_MINIMAL ;
248+ mco.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL ;
247249 mco.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
248250#endif
249251
@@ -356,7 +358,11 @@ bool jitc_optix_compile(ThreadState *ts, const char *buf, size_t buf_size,
356358
357359 OptixPipelineLinkOptions link_options {};
358360 link_options.maxTraceDepth = 1 ;
361+ #ifndef DRJIT_ENABLE_OPTIX_DEBUG_VALIDATION_ON
359362 link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
363+ #else
364+ link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
365+ #endif
360366
361367 size_t size_before = pipeline.program_groups .size ();
362368#if 0
0 commit comments