Page MenuHome

Cycles: replace integrator state argument macros
ClosedPublic

Authored by Brecht Van Lommel (brecht) on Oct 16 2021, 12:08 AM.

Details

Summary
  • Rename struct KernelGlobals to struct KernelGlobalsCPU
  • Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs that every device can define in its own way.
  • Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and replace with these new typedefs.
  • Add explicit state argument to INTEGRATOR_STATE and similar macros

In preparation for decoupling main and shadow paths.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested review of this revision.Oct 16 2021, 12:08 AM
Brecht Van Lommel (brecht) created this revision.

The code seems fine.

This revision is now accepted and ready to land.Oct 18 2021, 11:18 AM

@Brecht Van Lommel (brecht) , I think this is okay. Assuming KernelGlobals is used exclusively for parameter declarations, we can add a #define KernelGlobals ccl_global KernelGlobalsGPU or similar in our compat.h

KernelGlobals is only for parameter declarations in practice (IntegratorState is not).

So #define should work, though typedef like CUDA would be a little cleaner if it works.

typedef ccl_global const KernelGlobalsGPU *ccl_restrict KernelGlobals;
Sergey Sharybin (sergey) requested changes to this revision.Oct 18 2021, 12:33 PM

The general direction seems interesting to me!

The extra warning is rather annoying though.

Am i right the integrator flow macro mush not rely on the existence of the kg is the current scope and we can simply do path_state_init(KernelGlobals /*kg*/, ?

intern/cycles/kernel/device/cpu/globals.h
57

From my understanding you can only inform the compiler that it's OK to have typedef which is unused, but you can't make it so variables are "inheriting" the maybe-unused attribute.

intern/cycles/kernel/kernel_path_state.h
34

Got a compiler warning that the kg is unused.

This revision now requires changes to proceed.Oct 18 2021, 12:33 PM
Brecht Van Lommel (brecht) marked 2 inline comments as done.Oct 18 2021, 5:09 PM
This revision is now accepted and ready to land.Oct 18 2021, 5:14 PM