mitsuba3
mitsuba3 copied to clipboard
- [🐛 bug report] LoopRecord
Summary
Simple rejection sampling loop does not work.
System configuration
- Platform: Ubuntu2004
- Compiler: clang12
- Python version: 3.8.8
- Mitsuba 3 version: 9a588fab5405cf7e7adf9536643795de5f361735 (latest)
- Compiled variants:
-
llvm_ad_rgb
-
cuda_ad_rgb
-
Description
When LoopRecord is disabled, both LLVM and CUDA work. When enabled, llvm complains
Critical Dr.Jit compiler failure: jit_llvm_compile(): parsing failed. drjit_561bf61d2e73fe582c243e53d5d7a37c:130:30: error: use of undefined value '%f93_final' %f93 = phi <8 x float> [ %f93_final, %l_90_tail ], [ %f89, %l_90_start ]
Cuda can run without warning, but the output dir_world
is empty (while count
is correct).
Steps to reproduce
import drjit as dr
import mitsuba as mi
mi.set_variant('llvm_ad_rgb')
N_sample = 10
sampler = mi.load_dict({"type": "independent"})
sampler.seed(7, N_sample)
active = mi.Bool(True)
count = mi.UInt32(0)
dir_world = dr.zero(mi.Vector3f)
with dr.scoped_set_flag(dr.JitFlag.LoopRecord, True):
loop = mi.Loop("Trapezoid_effe_rejection_sampling", lambda: (active, dir_world, count, sampler))
while loop(active):
sample = sampler.next_2d(active)
r = sample.x
theta = dr.lerp(0.0, 3.0, sample.y)
s, c = dr.sincos(theta)
dir_world = mi.Vector3f(r * c, r * s, dr.safe_sqrt(dr.fnmadd(r, r, 1.0)))
count += mi.UInt32(1)
active &= (dir_world.x < 0.2) & (count < 1000)
print(count)
print(dir_world)