drjit
drjit copied to clipboard
Reading back to Scalar types floods cache dir with kernels
Depending on how I read back values from wide device arrays to scalar arrays, I find a weird issue with unexpected kernel regeneration on every read: Using .numpy()
to access values generates new kernels every time, whereas dr.slice(...)
does not result in additional kernels (only one kernel cached in ~/.drjit).
Interestingly, this behavior is only observed for more complex types such as Array3f
, Matrix4f
, Transform4f
, but not for Float
. Are there some kind of uncached reshuffling kernels involved in the multi-dimensional .numpy()
accessors?
Repro
Tested on Ubuntu 20.04 LTS with Python 3.8:
import drjit as dr
from drjit.scalar import Array3f as ScalarArray3f
from drjit.cuda.ad import Array3f
device = Array3f(3.0)
for i in range(100):
host = ScalarArray3f(device.numpy()) # generates many kernels in ~/.drjit
#host = ScalarArray3f(dr.slice(device)) # generates one kernel in ~/.drjit
host[0] += i
device.assign(host)
print(device)