aboutsummaryrefslogtreecommitdiff
path: root/compute_kernel_writer/prototype/include
diff options
context:
space:
mode:
Diffstat (limited to 'compute_kernel_writer/prototype/include')
-rw-r--r--compute_kernel_writer/prototype/include/ckw/Error.h7
-rw-r--r--compute_kernel_writer/prototype/include/ckw/KernelArgument.h3
-rw-r--r--compute_kernel_writer/prototype/include/ckw/KernelWriter.h32
-rw-r--r--compute_kernel_writer/prototype/include/ckw/KernelWriterHelper.h122
-rw-r--r--compute_kernel_writer/prototype/include/ckw/OperandBase.h1
-rw-r--r--compute_kernel_writer/prototype/include/ckw/ScalarValue.h8
-rw-r--r--compute_kernel_writer/prototype/include/ckw/TensorInfo.h8
-rw-r--r--compute_kernel_writer/prototype/include/ckw/TensorOperand.h26
-rw-r--r--compute_kernel_writer/prototype/include/ckw/TensorTileSampler.h56
-rw-r--r--compute_kernel_writer/prototype/include/ckw/TileInfo.h2
-rw-r--r--compute_kernel_writer/prototype/include/ckw/types/Functions.h20
-rw-r--r--compute_kernel_writer/prototype/include/ckw/types/Operators.h4
-rw-r--r--compute_kernel_writer/prototype/include/ckw/types/TensorSamplerTypes.h40
13 files changed, 188 insertions, 141 deletions
diff --git a/compute_kernel_writer/prototype/include/ckw/Error.h b/compute_kernel_writer/prototype/include/ckw/Error.h
index b18944eac5..aab713c817 100644
--- a/compute_kernel_writer/prototype/include/ckw/Error.h
+++ b/compute_kernel_writer/prototype/include/ckw/Error.h
@@ -39,11 +39,11 @@ namespace ckw
#define CKW_ASSERT_MSG(cond, msg) \
do \
{ \
- if(!(cond)) \
+ if (!(cond)) \
{ \
throw ::std::runtime_error(msg); \
} \
- } while(false)
+ } while (false)
/** If the condition is not met, throw an std::runtime_error.
*
@@ -56,8 +56,7 @@ namespace ckw
* @param[in] precond The condition if is met requires the consequence must also be met.
* @param[in] cond The condition that is expected to be true if the precondition is true.
*/
-#define CKW_ASSERT_IF(precond, cond) \
- CKW_ASSERT_MSG(!(precond) || ((precond) && (cond)), #precond " |-> " #cond)
+#define CKW_ASSERT_IF(precond, cond) CKW_ASSERT_MSG(!(precond) || ((precond) && (cond)), #precond " |-> " #cond)
/** Mark the variables as unused.
*
diff --git a/compute_kernel_writer/prototype/include/ckw/KernelArgument.h b/compute_kernel_writer/prototype/include/ckw/KernelArgument.h
index af8bcde634..3384a20aef 100644
--- a/compute_kernel_writer/prototype/include/ckw/KernelArgument.h
+++ b/compute_kernel_writer/prototype/include/ckw/KernelArgument.h
@@ -26,6 +26,7 @@
#define CKW_PROTOTYPE_INCLUDE_CKW_KERNELARGUMENT_H
#include "ckw/TensorInfo.h"
+
#include <cstdint>
namespace ckw
@@ -98,7 +99,7 @@ private:
TensorComponentType tensor_component_type;
};
- SubId _sub_id{ 0 };
+ SubId _sub_id{0};
};
} // namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/KernelWriter.h b/compute_kernel_writer/prototype/include/ckw/KernelWriter.h
index fdb5fedc59..f9e0066f91 100644
--- a/compute_kernel_writer/prototype/include/ckw/KernelWriter.h
+++ b/compute_kernel_writer/prototype/include/ckw/KernelWriter.h
@@ -94,7 +94,9 @@ public:
*
* @return The @ref TensorOperand object.
*/
- TensorOperand &declare_tensor_argument(const std::string &name, const TensorInfo &info, TensorStorageType storage_type = TensorStorageType::BufferUint8Ptr);
+ TensorOperand &declare_tensor_argument(const std::string &name,
+ const TensorInfo &info,
+ TensorStorageType storage_type = TensorStorageType::BufferUint8Ptr);
/** Declare a compile-time constant scalar argument.
*
@@ -134,7 +136,10 @@ public:
* @param[in] sampler The tensor sampling information.
* @param[in] dilation_y Dilation in the Y dimension.
*/
- void op_load(TileOperand &tile, const TensorOperand &tensor, const TensorTileSampler &sampler, const TileOperand &dilation_y = TileOperand("dil_y", 1));
+ void op_load(TileOperand &tile,
+ const TensorOperand &tensor,
+ const TensorTileSampler &sampler,
+ const TileOperand &dilation_y = TileOperand("dil_y", 1));
/** Load the data from the tensor memory to the tile using the indirect buffer approach and respective of the sampling information.
*
@@ -221,7 +226,10 @@ public:
* @param[in] first The first argument tile.
* @param[in] second The second argument tile.
*/
- void op_binary_elementwise_function(const TileOperand &dst, BinaryFunction func, const TileOperand &first, const TileOperand &second);
+ void op_binary_elementwise_function(const TileOperand &dst,
+ BinaryFunction func,
+ const TileOperand &first,
+ const TileOperand &second);
/** Write function applied to scalar value: `<dst> = <func>(<first>, <second>, <third>);`.
*
@@ -231,7 +239,11 @@ public:
* @param[in] second The second argument tile.
* @param[in] third The third argument tile.
*/
- void op_ternary_elementwise_function(const TileOperand &dst, TernaryFunction func, const TileOperand &first, const TileOperand &second, const TileOperand &third);
+ void op_ternary_elementwise_function(const TileOperand &dst,
+ TernaryFunction func,
+ const TileOperand &first,
+ const TileOperand &second,
+ const TileOperand &third);
/** Write if-statement: `if(<lhs> <op> <rhs>) { <body> }`.
*
@@ -267,7 +279,13 @@ public:
* @param[in, out] update_value The value which is updated at every iteration.
* @param[in] body The body of the for-loop.
*/
- void op_for_loop(const TileOperand &var_name, BinaryOp cond_op, const TileOperand &cond_value_name, const TileOperand &update_var_name, AssignmentOp update_op, const TileOperand &update_value_name, const std::function<void()> &body);
+ void op_for_loop(const TileOperand &var_name,
+ BinaryOp cond_op,
+ const TileOperand &cond_value_name,
+ const TileOperand &update_var_name,
+ AssignmentOp update_op,
+ const TileOperand &update_value_name,
+ const std::function<void()> &body);
/** Write the return statement: `return;`
*/
@@ -311,8 +329,8 @@ private:
::std::unique_ptr<prototype::GpuKernelWriterAttribute> _impl_attr;
::std::unique_ptr<prototype::IGpuKernelWriter> _impl;
- int32_t _id_space{ 0 };
- int32_t _max_id_space{ 0 };
+ int32_t _id_space{0};
+ int32_t _max_id_space{0};
};
} // namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/KernelWriterHelper.h b/compute_kernel_writer/prototype/include/ckw/KernelWriterHelper.h
index a8be859680..3ba079bbc2 100644
--- a/compute_kernel_writer/prototype/include/ckw/KernelWriterHelper.h
+++ b/compute_kernel_writer/prototype/include/ckw/KernelWriterHelper.h
@@ -32,8 +32,6 @@
#include <iostream>
#include <type_traits>
-#include <iostream>
-
/*
* By including this header file you will be able to supplement the default
* Compute Kernel Writer API with additional syntax to help ease the use of CKW.
@@ -154,7 +152,9 @@ struct can_be_assigned<TileOperand &> : ::std::true_type
* @tparam TLeft The type of the destination of the assignment.
* @tparam TRight The type of the source assigned to the destination.
*/
-template <typename TLeft, typename TRight, typename = ::std::enable_if<can_be_operand<TRight>::value && can_be_assigned<TLeft>::value>>
+template <typename TLeft,
+ typename TRight,
+ typename = ::std::enable_if<can_be_operand<TRight>::value && can_be_assigned<TLeft>::value>>
struct Assignment
{
TLeft lhs;
@@ -173,7 +173,7 @@ struct Assignment
template <typename TLeft, typename TRight>
inline Assignment<TLeft, TRight> operator+=(TLeft &&lhs, TRight &&rhs)
{
- return Assignment<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), AssignmentOp::Increment };
+ return Assignment<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), AssignmentOp::Increment};
}
/** Represents the expression: `\p lhs -= \p rhs`.
@@ -187,7 +187,7 @@ inline Assignment<TLeft, TRight> operator+=(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline Assignment<TLeft, TRight> operator-=(TLeft &&lhs, TRight &&rhs)
{
- return Assignment<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), AssignmentOp::Decrement };
+ return Assignment<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), AssignmentOp::Decrement};
}
// ==================================================
@@ -221,7 +221,7 @@ struct can_be_operand<UnaryExpression<TLeft>> : ::std::true_type
template <typename TSrc>
inline UnaryExpression<TSrc> operator!(TSrc &&src)
{
- return UnaryExpression<TSrc>{ std::forward<TSrc>(src), UnaryOp::LogicalNot };
+ return UnaryExpression<TSrc>{std::forward<TSrc>(src), UnaryOp::LogicalNot};
}
/** Represents the expression: `~\p src`.
@@ -233,7 +233,7 @@ inline UnaryExpression<TSrc> operator!(TSrc &&src)
template <typename TSrc>
inline UnaryExpression<TSrc> operator~(TSrc &&src)
{
- return UnaryExpression<TSrc>{ std::forward<TSrc>(src), UnaryOp::BitwiseNot };
+ return UnaryExpression<TSrc>{std::forward<TSrc>(src), UnaryOp::BitwiseNot};
}
// ==================================================
@@ -247,7 +247,9 @@ inline UnaryExpression<TSrc> operator~(TSrc &&src)
* @tparam TLeft The type of the left argument of the expression.
* @tparam TRight The type of the right argument of the expression.
*/
-template <typename TLeft, typename TRight, typename = ::std::enable_if_t<can_be_operand<TLeft>::value && can_be_operand<TRight>::value>>
+template <typename TLeft,
+ typename TRight,
+ typename = ::std::enable_if_t<can_be_operand<TLeft>::value && can_be_operand<TRight>::value>>
struct BinaryExpression
{
TLeft lhs;
@@ -271,7 +273,7 @@ struct can_be_operand<BinaryExpression<TLeft, TRight>> : ::std::true_type
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator+(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Add };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Add};
}
/** Represents the expression: `\p lhs - \p rhs`.
@@ -285,7 +287,7 @@ inline BinaryExpression<TLeft, TRight> operator+(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator-(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Sub };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Sub};
}
/** Represents the expression: `\p lhs * \p rhs`.
@@ -299,7 +301,7 @@ inline BinaryExpression<TLeft, TRight> operator-(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator*(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Mul };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Mul};
}
/** Represents the expression: `\p lhs / \p rhs`.
@@ -313,7 +315,7 @@ inline BinaryExpression<TLeft, TRight> operator*(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator/(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Div };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Div};
}
/** Represents the expression: `\p lhs % \p rhs`.
@@ -327,7 +329,7 @@ inline BinaryExpression<TLeft, TRight> operator/(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator%(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Mod };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Mod};
}
/** Represents the expression: `\p lhs == \p rhs`.
@@ -341,7 +343,7 @@ inline BinaryExpression<TLeft, TRight> operator%(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator==(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Equal };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Equal};
}
/** Represents the expression: `\p lhs < \p rhs`.
@@ -355,7 +357,7 @@ inline BinaryExpression<TLeft, TRight> operator==(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator<(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Less };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Less};
}
/** Represents the expression: `\p lhs <= \p rhs`.
@@ -369,7 +371,7 @@ inline BinaryExpression<TLeft, TRight> operator<(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator<=(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LessEqual };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LessEqual};
}
/** Represents the expression: `\p lhs > \p rhs`.
@@ -383,7 +385,7 @@ inline BinaryExpression<TLeft, TRight> operator<=(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator>(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Greater };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::Greater};
}
/** Represents the expression: `\p lhs >= \p rhs`.
@@ -397,7 +399,7 @@ inline BinaryExpression<TLeft, TRight> operator>(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator>=(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::GreaterEqual };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::GreaterEqual};
}
/** Represents the expression: `\p lhs ^ \p rhs`.
@@ -411,7 +413,7 @@ inline BinaryExpression<TLeft, TRight> operator>=(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> operator^(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::BitwiseXOR };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::BitwiseXOR};
}
/** Represents the expression: `\p lhs && \p rhs`.
@@ -425,7 +427,7 @@ inline BinaryExpression<TLeft, TRight> operator^(TLeft &&lhs, TRight &&rhs)
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> logical_and(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalAnd };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalAnd};
}
/** Represents the expression: `\p lhs && \p rhs`.
@@ -440,7 +442,7 @@ template <typename TLeft, typename TRight, typename... TOps>
inline BinaryExpression<BinaryExpression<TLeft, TRight>, TOps...> logical_and(TLeft &&lhs, TRight &&rhs, TOps &&...ops)
{
return logical_and(
- BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalAnd },
+ BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalAnd},
std::forward<TOps>(ops)...);
}
@@ -455,7 +457,7 @@ inline BinaryExpression<BinaryExpression<TLeft, TRight>, TOps...> logical_and(TL
template <typename TLeft, typename TRight>
inline BinaryExpression<TLeft, TRight> logical_or(TLeft &&lhs, TRight &&rhs)
{
- return BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalOr };
+ return BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalOr};
}
/** Represents the expression: `\p lhs || \p rhs`.
@@ -470,7 +472,7 @@ template <typename TLeft, typename TRight, typename... TOps>
inline BinaryExpression<BinaryExpression<TLeft, TRight>, TOps...> logical_or(TLeft &&lhs, TRight &&rhs, TOps &&...ops)
{
return logical_or(
- BinaryExpression<TLeft, TRight>{ std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalOr },
+ BinaryExpression<TLeft, TRight>{std::forward<TLeft>(lhs), std::forward<TRight>(rhs), BinaryOp::LogicalOr},
std::forward<TOps>(ops)...);
}
@@ -505,7 +507,7 @@ struct can_be_operand<UnaryElementwiseFunction<TLeft>> : ::std::true_type
template <typename TSrc>
UnaryElementwiseFunction<TSrc> exp(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Exp };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Exp};
}
/** Represents the expression: `tanh(\p src)`.
@@ -517,7 +519,7 @@ UnaryElementwiseFunction<TSrc> exp(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> tanh(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Tanh };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Tanh};
}
/** Represents the expression: `sqrt(\p src)`.
@@ -529,7 +531,7 @@ UnaryElementwiseFunction<TSrc> tanh(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> sqrt(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Sqrt };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Sqrt};
}
/** Represents the expression: `erf(\p src)`.
@@ -541,7 +543,7 @@ UnaryElementwiseFunction<TSrc> sqrt(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> erf(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Erf };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Erf};
}
/** Represents the expression: `fabs(\p src)`.
@@ -553,7 +555,7 @@ UnaryElementwiseFunction<TSrc> erf(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> fabs(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Fabs };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Fabs};
}
/** Represents the expression: `log(\p src)`.
@@ -565,7 +567,7 @@ UnaryElementwiseFunction<TSrc> fabs(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> log(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Log };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Log};
}
/** Represents the expression: `round(\p src)`.
@@ -577,7 +579,7 @@ UnaryElementwiseFunction<TSrc> log(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> round(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::Round };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::Round};
}
/** Represents the expression: `sizeof(\p src)`.
@@ -589,7 +591,7 @@ UnaryElementwiseFunction<TSrc> round(TSrc &&src)
template <typename TSrc>
UnaryElementwiseFunction<TSrc> sizeOf(TSrc &&src)
{
- return UnaryElementwiseFunction<TSrc>{ std::forward<TSrc>(src), UnaryFunction::SizeOf };
+ return UnaryElementwiseFunction<TSrc>{std::forward<TSrc>(src), UnaryFunction::SizeOf};
}
// ==================================================
@@ -603,7 +605,9 @@ UnaryElementwiseFunction<TSrc> sizeOf(TSrc &&src)
* @tparam TFirst The type of the left argument of the function.
* @tparam TSecond The type of the right argument of the function.
*/
-template <typename TFirst, typename TSecond, typename = ::std::enable_if<can_be_operand<TFirst>::value && can_be_operand<TSecond>::value>>
+template <typename TFirst,
+ typename TSecond,
+ typename = ::std::enable_if<can_be_operand<TFirst>::value && can_be_operand<TSecond>::value>>
struct BinaryElementwiseFunction
{
TFirst first;
@@ -627,7 +631,8 @@ struct can_be_operand<BinaryElementwiseFunction<TFirst, TSecond>> : ::std::true_
template <typename TFirst, typename TSecond>
BinaryElementwiseFunction<TFirst, TSecond> max(TFirst &&first, TSecond &&second)
{
- return BinaryElementwiseFunction<TFirst, TSecond>{ std::forward<TFirst>(first), std::forward<TSecond>(second), BinaryFunction::Max };
+ return BinaryElementwiseFunction<TFirst, TSecond>{std::forward<TFirst>(first), std::forward<TSecond>(second),
+ BinaryFunction::Max};
}
/** Represents the function call: `min(\p first, \p second)`.
@@ -641,7 +646,8 @@ BinaryElementwiseFunction<TFirst, TSecond> max(TFirst &&first, TSecond &&second)
template <typename TFirst, typename TSecond>
BinaryElementwiseFunction<TFirst, TSecond> min(TFirst &&first, TSecond &&second)
{
- return BinaryElementwiseFunction<TFirst, TSecond>{ std::forward<TFirst>(first), std::forward<TSecond>(second), BinaryFunction::Min };
+ return BinaryElementwiseFunction<TFirst, TSecond>{std::forward<TFirst>(first), std::forward<TSecond>(second),
+ BinaryFunction::Min};
}
// ==================================================
@@ -656,7 +662,11 @@ BinaryElementwiseFunction<TFirst, TSecond> min(TFirst &&first, TSecond &&second)
* @tparam TSecond The type of the second argument to the function.
* @tparam TThird The type of the third argument to the function.
*/
-template <typename TFirst, typename TSecond, typename TThird, typename = ::std::enable_if<can_be_operand<TFirst>::value && can_be_operand<TSecond>::value && can_be_operand<TThird>::value>>
+template <typename TFirst,
+ typename TSecond,
+ typename TThird,
+ typename = ::std::enable_if<can_be_operand<TFirst>::value && can_be_operand<TSecond>::value &&
+ can_be_operand<TThird>::value>>
struct TernaryElementwiseFunction
{
TFirst first;
@@ -683,7 +693,9 @@ struct can_be_operand<TernaryElementwiseFunction<TFirst, TSecond, TThird>> : ::s
template <typename TFirst, typename TSecond, typename TThird>
TernaryElementwiseFunction<TFirst, TSecond, TThird> select(TFirst &&first, TSecond &&second, TThird &&third)
{
- return TernaryElementwiseFunction<TFirst, TSecond, TThird>{ std::forward<TFirst>(first), std::forward<TSecond>(second), std::forward<TThird>(third), TernaryFunction::Select };
+ return TernaryElementwiseFunction<TFirst, TSecond, TThird>{std::forward<TFirst>(first),
+ std::forward<TSecond>(second),
+ std::forward<TThird>(third), TernaryFunction::Select};
}
/** Helper class used to extend a KernelWriter with additional functionality
@@ -715,7 +727,8 @@ public:
* @param[in] cond The BinaryExpression representing the condition.
* @param[in] body The body of the if-statement.
*/
- KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TileOperand &, TileOperand &> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TileOperand &, TileOperand &> &cond,
+ const std::function<void()> &body)
{
TWriter::op_if(cond.lhs, cond.opcode, cond.rhs, body);
return *this;
@@ -730,7 +743,8 @@ public:
* @param[in] body The body of the if-statement.
*/
template <typename TRight>
- KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TileOperand &, TRight> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TileOperand &, TRight> &cond,
+ const std::function<void()> &body)
{
auto &tmp1 = declare_temp_tile(cond.lhs.tile_info());
op_assign(tmp1, cond.rhs);
@@ -747,7 +761,8 @@ public:
* @param[in] body The body of the if-statement.
*/
template <typename TLeft>
- KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TLeft, TileOperand &> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_if(const BinaryExpression<TLeft, TileOperand &> &cond,
+ const std::function<void()> &body)
{
auto &tmp1 = declare_temp_tile(cond.rhs.tile_info());
op_assign(tmp1, cond.lhs);
@@ -766,7 +781,8 @@ public:
* @param[in] cond The BinaryExpression representing the condition.
* @param[in] body The body of the else-if-statement.
*/
- KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TileOperand &, TileOperand &> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TileOperand &, TileOperand &> &cond,
+ const std::function<void()> &body)
{
TWriter::op_else_if(cond.lhs, cond.opcode, cond.rhs, body);
return *this;
@@ -781,7 +797,8 @@ public:
* @param[in] body The body of the else-if-statement.
*/
template <typename TRight>
- KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TileOperand &, TRight> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TileOperand &, TRight> &cond,
+ const std::function<void()> &body)
{
auto &tmp1 = declare_temp_tile(cond.lhs.tile_info());
op_assign(tmp1, cond.rhs);
@@ -798,7 +815,8 @@ public:
* @param[in] body The body of the else-if-statement.
*/
template <typename TLeft>
- KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TLeft, TileOperand &> &cond, const std::function<void()> &body)
+ KernelWriterHelper<TWriter> &op_else_if(const BinaryExpression<TLeft, TileOperand &> &cond,
+ const std::function<void()> &body)
{
auto &tmp1 = declare_temp_tile(cond.rhs.tile_info());
op_assign(tmp1, cond.lhs);
@@ -823,7 +841,9 @@ public:
* @param[in] updater The Assignment representing the updater.
* @param[in] body The body of the for-loop.
*/
- void op_for_loop(const BinaryExpression<TileOperand &, TileOperand &> &cond, const Assignment<TileOperand &, TileOperand &> &updater, const std::function<void()> &body)
+ void op_for_loop(const BinaryExpression<TileOperand &, TileOperand &> &cond,
+ const Assignment<TileOperand &, TileOperand &> &updater,
+ const std::function<void()> &body)
{
TWriter::op_for_loop(cond.lhs, cond.opcode, cond.rhs, updater.lhs, updater.opcode, updater.rhs, body);
}
@@ -1029,7 +1049,8 @@ public:
* @param[in] dst The tile which is assigned to.
* @param[in] exp The TernaryElementwiseFunction representing the expression to be evaluated and assigned.
*/
- void op_assign(const TileOperand &dst, const TernaryElementwiseFunction<TileOperand &, TileOperand &, TileOperand &> &exp)
+ void op_assign(const TileOperand &dst,
+ const TernaryElementwiseFunction<TileOperand &, TileOperand &, TileOperand &> &exp)
{
TWriter::op_ternary_elementwise_function(dst, exp.opcode, exp.first, exp.second, exp.third);
}
@@ -1169,11 +1190,11 @@ public:
*/
void op_assign(const Assignment<TileOperand &, TileOperand &> &exp)
{
- if(exp.opcode == AssignmentOp::Increment)
+ if (exp.opcode == AssignmentOp::Increment)
{
TWriter::op_binary_expression(exp.lhs, exp.lhs, BinaryOp::Add, exp.rhs);
}
- else if(exp.opcode == AssignmentOp::Decrement)
+ else if (exp.opcode == AssignmentOp::Decrement)
{
TWriter::op_binary_expression(exp.lhs, exp.lhs, BinaryOp::Sub, exp.rhs);
}
@@ -1192,7 +1213,7 @@ public:
{
auto &tmp1 = declare_temp_tile(exp.lhs.tile_info());
op_assign(tmp1, exp.rhs);
- op_assign(Assignment<TileOperand &, TileOperand &>{ exp.lhs, tmp1, exp.opcode });
+ op_assign(Assignment<TileOperand &, TileOperand &>{exp.lhs, tmp1, exp.opcode});
}
private:
@@ -1241,11 +1262,8 @@ private:
template <typename... TOps, typename = ::std::enable_if_t<std::is_same<TOps..., TileInfo>::value>>
TileInfo get_largest_size(const TileInfo &first, const TileInfo &second, const TOps &...ops)
{
- TileInfo largest = {
- first.data_type(),
- std::max(first.width(), second.width()),
- std::max(first.height(), second.height())
- };
+ TileInfo largest = {first.data_type(), std::max(first.width(), second.width()),
+ std::max(first.height(), second.height())};
return get_largest_size(largest, ops...);
}
diff --git a/compute_kernel_writer/prototype/include/ckw/OperandBase.h b/compute_kernel_writer/prototype/include/ckw/OperandBase.h
index 06d9f82756..9842127339 100644
--- a/compute_kernel_writer/prototype/include/ckw/OperandBase.h
+++ b/compute_kernel_writer/prototype/include/ckw/OperandBase.h
@@ -26,6 +26,7 @@
#define CKW_PROTOTYPE_INCLUDE_CKW_OPERANDBASE_H
#include "ckw/types/DataType.h"
+
#include <string>
namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/ScalarValue.h b/compute_kernel_writer/prototype/include/ckw/ScalarValue.h
index 16c3f6d441..2a9c42acc8 100644
--- a/compute_kernel_writer/prototype/include/ckw/ScalarValue.h
+++ b/compute_kernel_writer/prototype/include/ckw/ScalarValue.h
@@ -59,9 +59,9 @@ public:
_size = sizeof(T);
- if(::std::is_integral<T>::value)
+ if (::std::is_integral<T>::value)
{
- if(::std::is_signed<T>::value)
+ if (::std::is_signed<T>::value)
{
_type = Type::INT;
_value.i64 = value;
@@ -90,9 +90,9 @@ public:
CKW_ASSERT(::std::is_integral<T>::value || ::std::is_floating_point<T>::value);
CKW_ASSERT(sizeof(T) >= _size);
- if(::std::is_integral<T>::value)
+ if (::std::is_integral<T>::value)
{
- if(::std::is_signed<T>::value)
+ if (::std::is_signed<T>::value)
{
CKW_ASSERT(_type == Type::INT || _type == Type::UINT);
CKW_ASSERT_IF(_type == Type::UINT, sizeof(T) > _size);
diff --git a/compute_kernel_writer/prototype/include/ckw/TensorInfo.h b/compute_kernel_writer/prototype/include/ckw/TensorInfo.h
index 55f8101a53..24da7dc8ab 100644
--- a/compute_kernel_writer/prototype/include/ckw/TensorInfo.h
+++ b/compute_kernel_writer/prototype/include/ckw/TensorInfo.h
@@ -143,10 +143,10 @@ public:
int32_t id() const;
private:
- TensorShape _shape{ { 0 } };
- DataType _dt{ DataType::Unknown };
- TensorDataLayout _dl{ TensorDataLayout::Unknown };
- int32_t _id{ -1 };
+ TensorShape _shape{{0}};
+ DataType _dt{DataType::Unknown};
+ TensorDataLayout _dl{TensorDataLayout::Unknown};
+ int32_t _id{-1};
};
} // namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/TensorOperand.h b/compute_kernel_writer/prototype/include/ckw/TensorOperand.h
index 6d88932c66..c221b449fa 100644
--- a/compute_kernel_writer/prototype/include/ckw/TensorOperand.h
+++ b/compute_kernel_writer/prototype/include/ckw/TensorOperand.h
@@ -139,21 +139,21 @@ private:
TensorInfo _info;
TensorStorageType _storage_type;
- TileOperand *_tile{ nullptr };
+ TileOperand *_tile{nullptr};
TensorTileSampler _tile_sampler{};
- ::std::unique_ptr<TensorComponentOperand> _stride1{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _stride2{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _stride3{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _stride4{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim0{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim1{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim2{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim3{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim4{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim1_dim2{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _dim1_dim2_dim3{ nullptr };
- ::std::unique_ptr<TensorComponentOperand> _offset_first_element_in_bytes{ nullptr };
+ ::std::unique_ptr<TensorComponentOperand> _stride1{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _stride2{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _stride3{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _stride4{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim0{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim1{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim2{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim3{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim4{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim1_dim2{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _dim1_dim2_dim3{nullptr};
+ ::std::unique_ptr<TensorComponentOperand> _offset_first_element_in_bytes{nullptr};
};
// =================================================================================================
diff --git a/compute_kernel_writer/prototype/include/ckw/TensorTileSampler.h b/compute_kernel_writer/prototype/include/ckw/TensorTileSampler.h
index e1bf0c52b8..606dec3535 100644
--- a/compute_kernel_writer/prototype/include/ckw/TensorTileSampler.h
+++ b/compute_kernel_writer/prototype/include/ckw/TensorTileSampler.h
@@ -26,6 +26,7 @@
#define CKW_PROTOTYPE_INCLUDE_CKW_TENSORTILESAMPLER_H
#include "ckw/types/TensorSamplerTypes.h"
+
#include <functional>
namespace ckw
@@ -55,12 +56,14 @@ public:
* @param[in] address_mode_y The address mode of the y dimension.
* @param[in] address_mode_z The address mode of the z dimension.
*/
- TensorTileSampler(
- TileOperand &x, TileOperand &y, TileOperand &z, TileOperand &b,
- TensorSamplerFormat format,
- TensorSamplerAddressModeX address_mode_x,
- TensorSamplerAddressModeY address_mode_y,
- TensorSamplerAddressModeZ address_mode_z);
+ TensorTileSampler(TileOperand &x,
+ TileOperand &y,
+ TileOperand &z,
+ TileOperand &b,
+ TensorSamplerFormat format,
+ TensorSamplerAddressModeX address_mode_x,
+ TensorSamplerAddressModeY address_mode_y,
+ TensorSamplerAddressModeZ address_mode_z);
/** Initialize a new instance of @ref TensorSampler class.
*
@@ -75,13 +78,16 @@ public:
* @param[in] address_mode_y The address mode of the y dimension.
* @param[in] address_mode_z The address mode of the z dimension.
*/
- TensorTileSampler(
- TileOperand &x, TileOperand &y, TileOperand &z, TileOperand &b,
- int32_t height, int32_t width,
- TensorSamplerFormat format,
- TensorSamplerAddressModeX address_mode_x,
- TensorSamplerAddressModeY address_mode_y,
- TensorSamplerAddressModeZ address_mode_z);
+ TensorTileSampler(TileOperand &x,
+ TileOperand &y,
+ TileOperand &z,
+ TileOperand &b,
+ int32_t height,
+ int32_t width,
+ TensorSamplerFormat format,
+ TensorSamplerAddressModeX address_mode_x,
+ TensorSamplerAddressModeY address_mode_y,
+ TensorSamplerAddressModeZ address_mode_z);
/** Get the coordinate in the x dimension. */
const TileOperand &x() const;
@@ -144,18 +150,18 @@ public:
TensorTileSampler &address_mode_z(TensorSamplerAddressModeZ address_mode_z);
private:
- TileOperand *_x{ nullptr };
- TileOperand *_y{ nullptr };
- TileOperand *_z{ nullptr };
- TileOperand *_b{ nullptr };
-
- int32_t _height{ 0 };
- int32_t _width{ 0 };
-
- TensorSamplerFormat _format{ TensorSamplerFormat::Unknown };
- TensorSamplerAddressModeX _address_mode_x{ TensorSamplerAddressModeX::Unknown };
- TensorSamplerAddressModeY _address_mode_y{ TensorSamplerAddressModeY::Unknown };
- TensorSamplerAddressModeZ _address_mode_z{ TensorSamplerAddressModeZ::Unknown };
+ TileOperand *_x{nullptr};
+ TileOperand *_y{nullptr};
+ TileOperand *_z{nullptr};
+ TileOperand *_b{nullptr};
+
+ int32_t _height{0};
+ int32_t _width{0};
+
+ TensorSamplerFormat _format{TensorSamplerFormat::Unknown};
+ TensorSamplerAddressModeX _address_mode_x{TensorSamplerAddressModeX::Unknown};
+ TensorSamplerAddressModeY _address_mode_y{TensorSamplerAddressModeY::Unknown};
+ TensorSamplerAddressModeZ _address_mode_z{TensorSamplerAddressModeZ::Unknown};
};
} // namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/TileInfo.h b/compute_kernel_writer/prototype/include/ckw/TileInfo.h
index de9e47af2b..e0d064169e 100644
--- a/compute_kernel_writer/prototype/include/ckw/TileInfo.h
+++ b/compute_kernel_writer/prototype/include/ckw/TileInfo.h
@@ -83,7 +83,7 @@ public:
DataType data_type() const;
private:
- DataType _dt{ DataType::Unknown };
+ DataType _dt{DataType::Unknown};
TileShape _shape{};
};
diff --git a/compute_kernel_writer/prototype/include/ckw/types/Functions.h b/compute_kernel_writer/prototype/include/ckw/types/Functions.h
index bc1f85c188..c6afaa0ac8 100644
--- a/compute_kernel_writer/prototype/include/ckw/types/Functions.h
+++ b/compute_kernel_writer/prototype/include/ckw/types/Functions.h
@@ -32,14 +32,14 @@ namespace ckw
enum class UnaryFunction : int32_t
{
- Exp = 0x0000,
- Tanh = 0x0001,
- Sqrt = 0x0002,
- Erf = 0x0003,
- Fabs = 0x0004,
- Log = 0x0006,
- Round = 0x0007,
- Floor = 0x0008,
+ Exp = 0x0000,
+ Tanh = 0x0001,
+ Sqrt = 0x0002,
+ Erf = 0x0003,
+ Fabs = 0x0004,
+ Log = 0x0006,
+ Round = 0x0007,
+ Floor = 0x0008,
// Misc
SizeOf = 0x0009,
@@ -47,8 +47,8 @@ enum class UnaryFunction : int32_t
enum class BinaryFunction : int32_t
{
- Min = 0x0000,
- Max = 0x0001,
+ Min = 0x0000,
+ Max = 0x0001,
};
enum class TernaryFunction : int32_t
diff --git a/compute_kernel_writer/prototype/include/ckw/types/Operators.h b/compute_kernel_writer/prototype/include/ckw/types/Operators.h
index 43241170a5..b560996837 100644
--- a/compute_kernel_writer/prototype/include/ckw/types/Operators.h
+++ b/compute_kernel_writer/prototype/include/ckw/types/Operators.h
@@ -69,8 +69,8 @@ enum class BinaryOp : int32_t
enum class AssignmentOp : int32_t
{
// Unary
- Increment = 0x0000, // +=
- Decrement = 0x0001, // -=
+ Increment = 0x0000, // +=
+ Decrement = 0x0001, // -=
};
} // namespace ckw
diff --git a/compute_kernel_writer/prototype/include/ckw/types/TensorSamplerTypes.h b/compute_kernel_writer/prototype/include/ckw/types/TensorSamplerTypes.h
index 836bd13c95..63405a0764 100644
--- a/compute_kernel_writer/prototype/include/ckw/types/TensorSamplerTypes.h
+++ b/compute_kernel_writer/prototype/include/ckw/types/TensorSamplerTypes.h
@@ -39,34 +39,38 @@ enum class TensorSamplerFormat : int32_t
enum class TensorSamplerAddressModeX : int32_t
{
- Unknown = 0,
- None = 1, // The user guarantees that the X coordinate is always in-bound
- OverlappingMin = 2 // (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
- // Leftover elements can be handled using overlapping. This involves processing some of the elements in the array twice.
+ Unknown = 0,
+ None = 1, // The user guarantees that the X coordinate is always in-bound
+ OverlappingMin =
+ 2 // (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
+ // Leftover elements can be handled using overlapping. This involves processing some of the elements in the array twice.
};
enum class TensorSamplerAddressModeY : int32_t
{
- Unknown = 0,
- None = 1, // The user guarantees that the Y coordinate is always in-bound
- OverlappingMin = 2, // (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
- Skip = 3, // Skip the read/write
- SkipMinEdgeOnly = 4, // Skip greater than or equal to max only. The user guarantees that the Y coordinate is always >= 0
- SkipMaxEdgeOnly = 5, // Skip less than 0 only
- ClampToNearest = 6, // Clamp the coordinate to nearest edge (0 or max value allowed on Y)
- ClampToMinEdgeOnly = 7, // Clamp the negative coordinate to 0 only. Therefore, we expect Y to be always < MAX
- ClampToMaxEdgeOnly = 8, // Clamp the coordinate to the max value allowed on Y only. We expect Y to be always >= 0
- ClampToBorder = 9, // Clamp to border which always has 0 value
+ Unknown = 0,
+ None = 1, // The user guarantees that the Y coordinate is always in-bound
+ OverlappingMin =
+ 2, // (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
+ Skip = 3, // Skip the read/write
+ SkipMinEdgeOnly =
+ 4, // Skip greater than or equal to max only. The user guarantees that the Y coordinate is always >= 0
+ SkipMaxEdgeOnly = 5, // Skip less than 0 only
+ ClampToNearest = 6, // Clamp the coordinate to nearest edge (0 or max value allowed on Y)
+ ClampToMinEdgeOnly = 7, // Clamp the negative coordinate to 0 only. Therefore, we expect Y to be always < MAX
+ ClampToMaxEdgeOnly = 8, // Clamp the coordinate to the max value allowed on Y only. We expect Y to be always >= 0
+ ClampToBorder = 9, // Clamp to border which always has 0 value
ClampToBorderMinEdgeOnly = 10,
ClampToBorderMaxEdgeOnly = 11
};
enum class TensorSamplerAddressModeZ : int32_t
{
- Unknown = 0,
- None = 1, // The user guarantees that the Y coordinate is always in-bound
- Skip = 3, // Skip the read/write
- SkipMinEdgeOnly = 4, // Skip greater than or equal to max only. The user guarantees that the Y coordinate is always >= 0
+ Unknown = 0,
+ None = 1, // The user guarantees that the Y coordinate is always in-bound
+ Skip = 3, // Skip the read/write
+ SkipMinEdgeOnly =
+ 4, // Skip greater than or equal to max only. The user guarantees that the Y coordinate is always >= 0
SkipMaxEdgeOnly = 5, // Skip less than 0 only
ClampToNearest = 6, // Clamp the coordinate to nearest edge (0 or max value allowed on Y)
ClampToMinEdgeOnly = 7, // Clamp the negative coordinate to 0 only. Therefore, we expect Y to be always < MAX