MU Library
kernel_signature.hpp File Reference
#include <array>
#include <cstdint>
#include <type_traits>
#include "mu/crt0/call_main_template.hpp"
Include dependency graph for kernel_signature.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mu::detail::is_complete_type< T, typename >
 
struct  mu::detail::is_complete_type< T, std::void_t< decltype(sizeof(T))> >
 
struct  mu::detail::ndarray_element< T >
 
struct  mu::detail::ndarray_element< mu::NDArray< T > >
 
struct  mu::detail::KernelSignature_t< T_Return(*)(T_Params...)>
 

Namespaces

 mu
 
 mu::detail
 

Macros

#define MU_KERNEL_SIGNATURE_PARAM(N)    ".if %c[paramCount] > " #N "\n.4byte %c[low" #N "]\n.4byte %c[high" #N "]\n.endif\n"
 
#define MU_KERNEL_SIGNATURE_OPERANDS(N)
 
#define MU_KERNEL_SIGNATURE(TARGET, NAME)
 Records a kernel's parameter list in the non-allocated .mu_kernel_sig section. More...
 

Enumerations

enum class  mu::detail::KernelParamKind : uint8_t { mu::detail::Scalar = 1 , mu::detail::Pointer = 2 , mu::detail::NDArray = 3 }
 
enum class  mu::detail::KernelParamDirection : uint8_t { mu::detail::None = 0 , mu::detail::Input = 1 , mu::detail::Output = 2 , mu::detail::InOut = 3 }
 

Functions

template<typename T >
constexpr uint32_t mu::detail::kernelElementSize ()
 
template<typename T_Direction >
constexpr KernelParamDirection mu::detail::kernelParamDirection ()
 
constexpr uint64_t mu::detail::packKernelParam (KernelParamKind kind, KernelParamDirection direction, uint8_t flags, uint32_t size)
 
template<typename T_Param >
constexpr uint64_t mu::detail::describeKernelParam ()
 
constexpr uint32_t mu::detail::kernelSignatureRecordSize (uint32_t paramCount, uint32_t nameLength)
 

Variables

constexpr uint32_t mu::detail::KernelSignatureMagic = 0x47534B4D
 
constexpr uint16_t mu::detail::KernelSignatureVersion = 1
 
constexpr uint32_t mu::detail::KernelSignatureHeaderSize = 16
 
constexpr uint32_t mu::detail::KernelSignatureParamSize = 8
 
constexpr uint32_t mu::detail::KernelSignatureMaxParams = 9
 
constexpr uint32_t mu::detail::KernelSignatureMaxRecordSize = UINT16_MAX
 
constexpr uint32_t mu::detail::KernelParamDirectionShift = 8
 
constexpr uint32_t mu::detail::KernelParamFlagsShift = 16
 
constexpr uint32_t mu::detail::KernelParamSizeShift = 32
 
constexpr uint8_t mu::detail::KernelParamWriteBack = 1
 
template<typename T_Signature , uint32_t index>
constexpr uint32_t mu::detail::kernelSignatureParamLow = static_cast<uint32_t>(T_Signature::Params[index])
 
template<typename T_Signature , uint32_t index>
constexpr uint32_t mu::detail::kernelSignatureParamHigh = static_cast<uint32_t>(T_Signature::Params[index] >> 32)
 
template<typename T_Signature , uint32_t nameLength>
constexpr uint32_t mu::detail::kernelSignatureRecordSizeOf = kernelSignatureRecordSize(T_Signature::ParamCount, nameLength)
 

Macro Definition Documentation

◆ MU_KERNEL_SIGNATURE

#define MU_KERNEL_SIGNATURE (   TARGET,
  NAME 
)

Records a kernel's parameter list in the non-allocated .mu_kernel_sig section.

Parameters
TARGETfunction name or template instance (ex: sort_with_ptr<int>)
NAMEthe kernel's runtime name as a string literal, equal to the kernel table's name. The caller stringizes it: an ID forwarded as a token would be macro-expanded first.

Definition at line 189 of file kernel_signature.hpp.

◆ MU_KERNEL_SIGNATURE_OPERANDS

#define MU_KERNEL_SIGNATURE_OPERANDS (   N)
Value:
[low##N] "i"(mu::detail::kernelSignatureParamLow<MuKernelSignature, N>), \
[high##N] "i"(mu::detail::kernelSignatureParamHigh<MuKernelSignature, N>)

Definition at line 177 of file kernel_signature.hpp.

◆ MU_KERNEL_SIGNATURE_PARAM

#define MU_KERNEL_SIGNATURE_PARAM (   N)     ".if %c[paramCount] > " #N "\n.4byte %c[low" #N "]\n.4byte %c[high" #N "]\n.endif\n"

Definition at line 174 of file kernel_signature.hpp.