23
23
#include < sstream>
24
24
#include < vector>
25
25
26
+ #define likely (x ) DRJIT_LIKELY(x)
27
+ #define unlikely (x ) DRJIT_UNLIKELY(x)
28
+
26
29
/* *
27
30
* \brief Helper struct to profile and log frozen functions.
28
31
*/
@@ -229,10 +232,10 @@ bool FlatVariables::fill_opaque_mask(FlatVariables &prev,
229
232
Layout &layout = this ->layout [i];
230
233
Layout &prev_layout = prev.layout [i];
231
234
232
- if (layout.flags & (uint32_t ) LayoutFlag::Literal &&
233
- prev_layout.flags & (uint32_t ) LayoutFlag::Literal &&
234
- (layout.literal != prev_layout.literal ||
235
- layout.index != prev_layout.index )) {
235
+ if (unlikely ( layout.flags & (uint32_t ) LayoutFlag::Literal &&
236
+ prev_layout.flags & (uint32_t ) LayoutFlag::Literal &&
237
+ (layout.literal != prev_layout.literal ||
238
+ layout.index != prev_layout.index ) )) {
236
239
opaque_mask[i] = true ;
237
240
new_opaques = true ;
238
241
}
@@ -288,14 +291,14 @@ void FlatVariables::schedule_jit_variables(bool schedule_force,
288
291
// is nice to have a fallback.
289
292
layout.literal = info.literal ;
290
293
// Store size in index variable, as this is not used for literals
291
- layout.index = info.size ;
292
- layout.vt = info.type ;
294
+ layout.index = info.size ;
295
+ layout.vt = ( uint32_t ) info.type ;
293
296
layout.literal_index = index ;
294
297
295
298
layout.flags |= (uint32_t ) LayoutFlag::Literal;
296
299
} else {
297
300
layout.index = this ->add_jit_index (index );
298
- layout.vt = info.type ;
301
+ layout.vt = ( uint32_t ) info.type ;
299
302
jit_var_dec_ref (index );
300
303
}
301
304
}
@@ -389,7 +392,7 @@ void FlatVariables::traverse_jit_index(uint32_t index, TraverseContext &ctx,
389
392
390
393
layout.flags |= (uint32_t ) LayoutFlag::JitIndex;
391
394
layout.index = index ;
392
- layout.vt = jit_var_type (index );
395
+ layout.vt = ( uint32_t ) jit_var_type (index );
393
396
}
394
397
395
398
/* *
@@ -408,7 +411,7 @@ uint32_t FlatVariables::construct_jit_index(uint32_t prev_index) {
408
411
if (layout.flags & (uint32_t ) LayoutFlag::Literal) {
409
412
index = layout.literal_index ;
410
413
jit_var_inc_ref (index );
411
- vt = layout.vt ;
414
+ vt = (VarType) layout.vt ;
412
415
} else {
413
416
VarLayout &var_layout = this ->var_layout [layout.index ];
414
417
index = this ->variables [layout.index ];
@@ -1706,6 +1709,7 @@ nb::object FunctionRecording::replay(nb::callable func,
1706
1709
}
1707
1710
1708
1711
nb::object FrozenFunction::operator ()(nb::args args, nb::kwargs kwargs) {
1712
+ ProfilerPhase profiler (" frozen function" );
1709
1713
nb::object result;
1710
1714
{
1711
1715
// Enter Isolate grad scope, so that gradients are not propagated
0 commit comments