Problems with reference to buffer on Turing architecture

I’m seeing an issue where temporarily storing a reference to a struct in an OptiX buffer causes problems. With the 318.81 driver, the code below appears to cause the GPU to infinite loop while the Windows Task Manager shows ~100% GPU “Copy” utilization. With the 317.71 driver, it crashed the computer. If I store thisThing by value, rather than reference, it all works fine. I don’t have a minimal reproducer, or know why this particular bit of code causes a problem - it’s not the only place I temporarily use a reference to something in a buffer. Is this buffer usage unsafe? In bufferId, operator returns T&, and I assumed it was safe to hold the reference for later use (within the same program invocation that retrieved it). I have been running this code on various Kepler, Maxwell, and Pascal GPUs, and so far have only seen a problem on Turing.

struct Thing {
float a;
float b;
float c;
float d;
int i;

rtBufferId<Thing, 1> bunchOfThings;

const Thing& thisThing = bunchOfThings[someIndex];
// Two lines of math using thisThing. No function calls, no storage of references.

CUDA 9.1, OptiX 5.1.0, Visual Studio 2015
RTX 2080 Ti, Windows 10, driver version 318.81 (and previously 317.71)

That should just work.

operator is the only allowed method to access a single element in a buffer, whatever type that one element is.
(Pointer arithmetic is generally not allowed on OptiX buffers on device side. If it works anyway, that is undefined behaviour and could break in the future.)

You could try if not using a reference but a copy of that element works.
const Thing thisThing = bunchOfThings[someIndex];

If you have OptiX usage reports enabled and you see warnings about pointers to buffers, that would also be one reason.

About your development environment.
1.) OptiX 5.1.0 does not officially support CUDA 9.1. You should use CUDA 9.0 instead. I’ve seen posts on this forum where CUDA 9.1 behaved incorrectly.
2.) Your driver versions can’t be right. There are no drivers lower than 411 for an RTX 2080 Ti.
3.) It doesn’t make sense anymore to use OptiX 5.1.0 on an RTX board. You need to update to OptiX 6.0.0 to make full use of that hardware, and that strictly requires 418.81 or newer drivers under Windows.
Read the forum posts about necessary changes. Look at the optixGeometryTriangles example closely.