What does RT_ERROR_INVALID_VALUE mean

I get above return code when trying to
rtBufferGetDevicePointer(
bufs.vertices->get(),
OCD->oOptixDev,
&OCD->pVtx )
So whose VALUE it is referring to?? I did go through the manual there is no more information on the enumeration.
I did check bufs.vertices->() passes RTBuffer verify method. And it passes the test.
Some help is much appreciated.

Hi there, have you checked the results of both rtContextGetErrorString() as well as from rtContextSetUsageReportCallback()?

I can see 4 different reasons that an invalid value might be returned:

  • If there’s an invalid device ordinal
  • If your buffer isn’t setup for CUDA interop
  • If the device isn’t enabled
  • If the buffer doesn’t have device memory allocated

What flags did you use for creating your buffer?

If you are in a position to consider moving to OptiX 7 in the future, I’d encourage it. Both CUDA interop and error handling are much improved.


David.

Here is how I created the buffer

bufs.VtxVars =
     context->createBuffer( RT_BUFFER_INPUT, 
                                               RT_FORMAT_FLOAT, 
                                          static_cast<size_t>(nVertices * nVtxVars)  );
  • On the device ordinal I did notice some strange behaviour. Some times it gives “6” and other times some other times a very large integer both negative an positive. In any case the run fails with same error.

  • From the following the device seems to be enabled.

Here is device info just before calling the getDevice pointer
rtDeviceGetAttribute() output
Number of optix devices: 1
Optix version: 60600
Max threads per block: 1024
Clock rate: 1113500
Multiprocessor count: 20
Execution timeout enabled: 0
Max hardware texture count: 1048576
Compute capability: sm_61
Total memory: 7981694976
TCC driver: 0

getEnabledDeviceCount = 1
getCPUNumThreads = 1
getUsedHostMemory = 66088
getGPUPagingActive = 0
getGPUPagingForcedOff = 0
getStackSize = 2688
getEntryPointCount = 1
getRayTypeCount = 2
getPrintBufferSize = 0
getVariableCount = 7
getDeviceCount = 1
getDeviceName = Tesla P4
Materials: 1
Mesh:
num vertices : 281
has normals : false
has texcoords: false
num triangles: 525
num materials: 1
bbox min : ( -1.5161, -0.035755, -0.035864 )
bbox max : ( 0, 0.0359, 0.035864 )
NVRTC Diabled getPtxStringFromFile

Ok. Now I know the issue is with Device Ordinal. It was my goof. I should have heeded the warning signs on device ordinal being inconsistent. The device ordinal variable in the call was not set. My sincere apologies for this. But at least the error code possibilities helps others :))

Hey glad you got it working! Zero need to apologize, we’re here to help. Just curious, in case we need to add or improve the error messages, did you end up trying either of the error message functions, the error string or the usage report?


David.

On the Error reporting issue, I had to modify RT_CHECK_ERROR as follows since APIError call does not provide this detail as expected. I did not bother investigating.

#define RT_CHECK_ERROR( func )                                     \
  do {                                                             \
    RTresult code = func;                                          \
    if( code != RT_SUCCESS ) {                                     \
      std::cout << "code: " << code << std::endl ;                 \
      std::cout << "File: " << __FILE__<< std::endl ;              \
      std::cout << "Line: " << __LINE__<< std::endl ;              \
      throw sutil::APIError( code, __FILE__, __LINE__ );           \
    }                                                              \
  } while(0)

Now Ii have no more errors in buffer creations and getDevicePointer calls. They all work with no issues. But the “context.validate()” fails with the

terminate called after throwing an instance of ‘optix::Exception’
what(): Variable not found (Details: Function “RTresult _rtContextValidate(RTcontext)” caught exception: Variable “Unresolved reference to variable bPixHit from _Z6camerav” not found in scope)

It is clear that it is having issue with bPixHit variable
On host side the following lines had no issue.
buffer = context->createBuffer(RT_BUFFER_OUTPUT,
RT_FORMAT_UNSIGNED_INT,
width, height );
context[“bPixHit”]-> setBuffer(buffer);

In my device side code “ptracer.cu” which contained RT_PROGRAM camera
rtBuffer<unsigned int, 2> bPixHit; is present.

So what is happening here. Does this anything to do with the fact that I have disabled NVRTC. I did make sure that NVIDIA card arch SM_61 that my instance is using matched with the value specified in CMakefile.

Unresolved key word appears to be pointing to some linking process . I did check in the build directory to see what happens to my optix related device code.
I do find
rat_generated_ptracer.cu.ptx.NVCC-depend , cmake, depend files

Here is “grep” output on the assembly code under ptx directory of lib
> ~/build/lib/ptx$ grep bPixHit rat_generated_ptracer.cu.ptx

> .global .align 1 .b8 bPixHit[1];

Also here is the header of the assembly that gives the detail on the compiler and architecure
/
// Generated by NVIDIA NVVM Compiler
//
// Compiler Build ID: CL-28540450
// Cuda compilation tools, release 11.0, V11.0.194
// Based on LLVM 3.4svn
//

.version 7.0
.target sm_61

Will be great if you can help resolve this. Not sure if I should have opened a new topic