Iray - an illegal memory access was encountered

I've been using Daz Studio 4.11.0.335 along with nvidia drivers 418.81 for a while now with no problems until recently. Yesterday I got my first error while rendering which caused Iray to fall back on the CPU. Today I rendered the same scene to see if the error would repeat and it did, though it took over 2 hrs. Yesterday it happened after around 1 hour. Here is part of the log with the error from todays render:
2019-05-02 12:15:50.397 Iray INFO - module:category(IRAY:RENDER): 1.0 IRAY rend info : Received update to 08271 iterations after 7668.871s.
2019-05-02 12:20:23.324 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray ERROR - module:category(IRAY:RENDER): 1.9 IRAY rend error: CUDA device 0 (GeForce RTX 2060): Kernel [18] (MaterialSurface ) failed after 0.022s
2019-05-02 12:20:23.324 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray ERROR - module:category(IRAY:RENDER): 1.9 IRAY rend error: CUDA device 0 (GeForce RTX 2060): an illegal memory access was encountered (while launching CUDA renderer)
2019-05-02 12:20:23.326 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray ERROR - module:category(IRAY:RENDER): 1.9 IRAY rend error: CUDA device 0 (GeForce RTX 2060): Failed to launch renderer
2019-05-02 12:20:23.326 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray ERROR - module:category(IRAY:RENDER): 1.2 IRAY rend error: CUDA device 0 (GeForce RTX 2060): Device failed while rendering
2019-05-02 12:20:23.326 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray WARNING - module:category(IRAY:RENDER): 1.2 IRAY rend warn : All available GPUs failed.
2019-05-02 12:20:23.327 WARNING: ..\..\..\..\..\src\pluginsource\DzIrayRender\dzneuraymgr.cpp(302): Iray WARNING - module:category(IRAY:RENDER): 1.2 IRAY rend warn : No devices activated. Enabling CPU fallback.
I searched the forum for similar fails and found it could be caused by the following:
1. Bad VRAM
2. GPU overheating
3. Driver Issues
Does anybody have any other possible causes for this type of fail?
Comments
out of memory probably via too many reflections and opacities in your scene - your scene is probably too big and complex for the video card RAM. If you scene is also to big for the CPU RAM then DAZ Studio will crash too.
If that was the case why would it start to render with the GPU? I thought if there is not enough VRAM that the scene would go right to the CPU. My scene fails well into the render and my VRAM wasn't maxxed out.
I'm not ruling out your reason. It just seems kind of odd that it happens in the middle of the render.
If you are using a genesis figure, check what level of subd you got it set at. I once set it to 8 by accident, and kept getting that an illegal memory access was encountered (while launching CUDA renderer) error, couldn't figure out why for like a hour lol.
Not necessarily. There could be other system processes that claim enough VRAM to cause it to happen during a render. If you are right at the edge of your VRAM capacity, anything could be causing it to spill over during a render.
Are you using the CPU when rendering? If you are, try unchecking it from all render options. Are you using OptiX acceleration? Enabling Optix can speed up rendering, but it it can also add more VRAM overhead.
I don't use the CPU to render, but I do use OptiX. I'll have to keep a close eye on my VRAM usage to see if that's the culprit. I'm pretty sure my VRAM was close to full capacity for the scene that gave the Iray error.
Usually if it's too much geometry & too much texture memory needed DAZ Studio will fail when you try to load the scene, especially if you do iRay preview. However, it actually doesn't allocate as much memory needed to render a scene until you actually try to render a scene at which time it usually will crash before it writes the 1st iteration of a render out as it builds the memory buffers needed to render the scene.
In some cases though, those involving lots & lots of opacity & transparency shaders applied to high geometry objects what happens is there is reflection which cause the memory needed to render those reflections of those opacities to grow & grow & grow. I actually had a scene like that and I set the scene to render memory (hard disk paging/swap) optimized rather than speed (RAM) optimized and watched as DAZ Studio rendered the scene it would claim more & more SSD space until if actually claimed all 20GB free SSD space and couldn't claim anymore. And this was the Windows system disk. I had to delete most of the geometries with so much opacity & reflections in them from the scene before I managed to get the scene to render without eventually crashing DAZ Studio.
I'm sure there are others ways to get DAZ Studio (iRay library really) to claim more & more memory until a crash happens. It's a common trick of programmers to exploit such algorithms to compromise computer security.
It should be easy to confirm/rule out VRAM limit. Forget the scene you have been trying to render for the moment, start a new one and keep it simple. Single character with no subd and a couple of lights. Go into your render settings and change the minimum samples to something much higher than required to force it to render for an extended period of time (you want to try and get it to render for as long as it took to crash in your previous scene)
And then see what happens. If you dont get the same crash, then you can pretty much confirm you are hitting your VRAM limit.
Alternatively, make sure you have a saved version of the scene you have been trying to render, then delete some things in the scene to reduce the VRAM load and try render it again
Same thing happened to me. The issue did turn out to be memory related. The error code is just a really bad way of saying that. Here's how I solved it.
I used Decimate to reduce the size of the three characters I had in the scene to 66% each. They still looked fine and render memory went from 24GB to 12GB. Scene rendered without a problem.
Good luck