Closed saeedhd96 closed 3 months ago
I should note that when I build Mitsuba from source, I get the following error when running the same code as above:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\MYNAME\AppData\Local\miniconda3\envs\MYENVNAME\lib\site-packages\torch\utils\dlpack.py", line 115, in from_dlpack
dlpack = ext_tensor.__dlpack__(stream=stream_ptr)
RuntimeError: jitc_malloc_device(): unknown address <0x1334c00000>!
FYI: the opposite case (DrJIT -> Torch -> DrJIT) does seem to work and is covered in these unit tests: https://github.com/mitsuba-renderer/drjit/blob/a306e34ca03501a8e806e06cb4486f0025203e6e/tests/test_conversion.py#L29-L64 It's only the Torch -> DrJIT -> Torch variant that crashes. Numpy -> DrJIT -> Numpy also seems to work fine.
I can reproduce this on Windows, even on the new refactored Dr.Jit. Nothing comes to mind, especially since it seems to be specific to Windows.
We'll have a look.
I finally got around to looking into all of the framework interoperability issues that have been raised.
I've pushed a fix to drjit:master
, it should be on mitsuba:master
soon.
However, if you've been working with a public release (i.e 3.5.2
and drjit==0.4.6
) the fix is slightly different. You will want to modify this line in router.py
to be:
return _dr.detail.device()
(If you've installed mitsuba/drjit with pip
you can modify the file directly in your site-packages
folder where pip installed it)
Summary
Moving a tensor from torch to Mitsuba and then back to torch causes an error on windows machine.
System configuration
System information:
OS: Windows 11 CPU: 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz GPU: NVIDIA RTX 5880 Ada Python version: 3.10 (error happens with 3.12 too) LLVM version: ... CUDA version: 12.2 NVidia driver: 537.99
Dr.Jit version: 0.4.6 Mitsuba version: 3.5.2 (also tested back to 3.0.0, occurred in all versoins) Compiled with: installed from pip Variants compiled: ['scalar_rgb', 'scalar_spectral', 'cuda_ad_rgb', 'llvm_ad_rgb']
PyTorch version: 2.3.1+cu121 (also tried 2.1.1 and 2.0.1, in those versions the program crashed quietly without the error)
Description
A weird error occurs when moving a tensor from torch to mitsuba and vice versa.
Steps to reproduce
error is: