StackSizeDefs

#include <poplar/StackSizeDefs.hpp>

Defines

TOTAL_STACK_USAGE
FUNCTION_IS_WORKER
DEF_STACK_USAGE_HELPER(size, funcname)
DEF_STACK_USAGE(size, funcname)

Used to specify the total stack usage of a function.

The use of this macro must be placed at file top level (not inside a function definition). This macro will add overrides for the stack size information for a C/C++ codelet function (either ‘own’ stack size only, or total stack usage, same as the assembly macros above).

Parameters
  • size – Size in bytes of the total stack usage of funcname, includes any function that might be called by funcname. Must be an unsigned integer literal.

  • funcname – A string literal containing the name of the function. If this is a C++ function, it must be the mangled name, so it might be convenient to define such a function as extern "C" for ease of use of this macro.

DEF_FUNC_CALL_PTRS(caller_func, called_func_list)

Macro to declare that a function might call other functions via function pointers.

Note that all function names below are strings containing the name of the functions, and if the functions are C++ ones, they must be the mangled name, so it might be convenient to define such functions as extern "C" for ease of use of this macro. The use of this macro must be placed at file top level (not inside a function definition).

Parameters
  • caller_func – A string literal containing the name of the function that calls other functions via function pointers.

  • called_func_list – a string literal containing a comma separated list of function names that are called via function pointers by caller_func.

DEF_FUNCTION_AS_WORKER(funcname)

Macro to declare that a function is run in the worker context.

The use of this macro must be placed in the same file where the function body is defined, at top level (not inside the function definition). Note that this is not needed for explicit worker vertices entry points (so for __runCodelet_XXXXX) and functions called directly by them. It is required only for worker code that is run from supervisor vertices but is not part of a worker vertex.

Parameters
  • funcname – A string literal containing the name of the function. If this is a C++ function, it must be the mangled name, so it might be convenient to define such a function as extern "C" for ease of use of the macro.