DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::detail::NDLoop< NDIMS > Struct Template Reference

Generates an NDIMS-dimensional perfect loop nest. More...

#include <CL/sycl/detail/common.hpp>

Static Public Member Functions

template<template< int > class LoopBoundTy, typename FuncTy , template< int > class LoopIndexTy = LoopBoundTy>
static __SYCL_ALWAYS_INLINE void iterate (const LoopBoundTy< NDIMS > &UpperBound, FuncTy f)
 Generates ND loop nest with {0,..0} . More...
 
template<template< int > class LoopBoundTy, typename FuncTy , template< int > class LoopIndexTy = LoopBoundTy>
static __SYCL_ALWAYS_INLINE void iterate (const LoopIndexTy< NDIMS > &LowerBound, const LoopBoundTy< NDIMS > &Stride, const LoopBoundTy< NDIMS > &UpperBound, FuncTy f)
 Generates ND loop nest with LowerBound . More...
 

Detailed Description

template<int NDIMS>
struct cl::sycl::detail::NDLoop< NDIMS >

Generates an NDIMS-dimensional perfect loop nest.

The purpose of this class is to better support handling of situations where there must be a loop nest over a multi-dimensional space - it allows to avoid generating unnecessary outer loops like 'for (int z=0; z<1; z++)' in case of 1D and 2D iteration spaces or writing specializations of the algorithms for 1D, 2D and 3D cases. Loop is unrolled in a reverse directions, i.e. ID = 0 is the inner-most one.

Definition at line 288 of file common.hpp.

Member Function Documentation

◆ iterate() [1/2]

template<int NDIMS>
template<template< int > class LoopBoundTy, typename FuncTy , template< int > class LoopIndexTy = LoopBoundTy>
static __SYCL_ALWAYS_INLINE void cl::sycl::detail::NDLoop< NDIMS >::iterate ( const LoopBoundTy< NDIMS > &  UpperBound,
FuncTy  f 
)
inlinestatic

Generates ND loop nest with {0,..0} .

. UpperBound bounds with unit stride. Applies f at each iteration, passing current index of LoopIndexTy<NDIMS> type as the parameter.

Definition at line 294 of file common.hpp.

◆ iterate() [2/2]

template<int NDIMS>
template<template< int > class LoopBoundTy, typename FuncTy , template< int > class LoopIndexTy = LoopBoundTy>
static __SYCL_ALWAYS_INLINE void cl::sycl::detail::NDLoop< NDIMS >::iterate ( const LoopIndexTy< NDIMS > &  LowerBound,
const LoopBoundTy< NDIMS > &  Stride,
const LoopBoundTy< NDIMS > &  UpperBound,
FuncTy  f 
)
inlinestatic

Generates ND loop nest with LowerBound .

. UpperBound bounds and stride Stride. Applies f at each iteration, passing current index of LoopIndexTy<NDIMS> type as the parameter.

Definition at line 312 of file common.hpp.


The documentation for this struct was generated from the following file: