Skip to content

Commit d8a53a3

Browse files
committed
Remove call to __exp2f since it does not exist
1 parent 76c695a commit d8a53a3

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

include/kernel_float/apply.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ using default_policy = KERNEL_FLOAT_POLICY;
157157

158158
namespace detail {
159159

160+
template<typename F, typename Output, typename... Args>
161+
struct invoke_impl {
162+
KERNEL_FLOAT_INLINE static Output call(F fun, Args... args) {
163+
return fun(args...);
164+
}
165+
};
166+
160167
//
161168
template<typename Policy, typename F, size_t N, typename Output, typename... Args>
162169
struct apply_fallback_impl {
@@ -186,13 +193,6 @@ template<int Level, typename F, size_t N, typename Output, typename... Args>
186193
struct apply_fallback_impl<approx_level_policy<Level>, F, N, Output, Args...>:
187194
apply_impl<approx_policy, F, N, Output, Args...> {};
188195

189-
template<typename F, typename Output, typename... Args>
190-
struct invoke_impl {
191-
KERNEL_FLOAT_INLINE static Output call(F fun, Args... args) {
192-
return fun(args...);
193-
}
194-
};
195-
196196
// Only for `accurate_policy` do we implement `apply_impl`, the others will fall back to `apply_base_impl`.
197197
template<typename F, size_t N, typename Output, typename... Args>
198198
struct apply_impl<accurate_policy, F, N, Output, Args...> {

include/kernel_float/unops.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ KERNEL_FLOAT_DEFINE_UNARY_FUN_FAST(rsqrt)
231231
}
232232

233233
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp, __expf(input))
234-
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp2, __exp2f(input))
234+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp2, __exp2f(input)) // Seems to be missing?
235235
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp10, __exp10f(input))
236236

237237
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, log, __logf(input))
@@ -257,19 +257,21 @@ KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, tan, __tanf(input))
257257
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(double, rcp, "rcp.approx.ftz.f64", "d")
258258
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(double, rsqrt, "rsqrt.approx.f64", "d")
259259

260+
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, exp2, "ex2.approx.f32", "f")
260261
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sqrt, "sqrt.approx.f32", "f")
261262
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, rcp, "rcp.approx.f32", "f")
262263
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, rsqrt, "rsqrt.approx.f32", "f")
263264
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, tanh, "tanh.approx.f32", "f")
265+
266+
// These are no longer necessary due to the KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN above
267+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sin, "sin.approx.f32", "f")
268+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, cos, "cos.approx.f32", "f")
269+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, log2, "lg2.approx.f32", "f")
264270
#endif
265271

266272
#define KERNEL_FLOAT_FAST_F32_MAP(F) \
267273
F(exp) F(exp2) F(exp10) F(log) F(log2) F(log10) F(sin) F(cos) F(tan) F(rcp) F(rsqrt) F(sqrt)
268274

269-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sin, "sin.approx.f32", "f")
270-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, cos, "cos.approx.f32", "f")
271-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, exp2, "ex2.approx.f32", "f")
272-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, log2, "lg2.approx.f32", "f")
273275
#else
274276
#define KERNEL_FLOAT_FAST_F32_MAP(F)
275277
#endif

single_include/kernel_float.h

+16-14
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
//================================================================================
1818
// this file has been auto-generated, do not modify its contents!
19-
// date: 2024-11-26 13:52:06.286983
20-
// git hash: c4c6ac09808d14b5407afb06ecdecd235cd50ed3
19+
// date: 2024-11-26 14:20:49.081641
20+
// git hash: 76c695a4cc5b13b3d5841ac5085574a5b47a299c
2121
//================================================================================
2222

2323
#ifndef KERNEL_FLOAT_MACROS_H
@@ -824,6 +824,13 @@ using default_policy = KERNEL_FLOAT_POLICY;
824824

825825
namespace detail {
826826

827+
template<typename F, typename Output, typename... Args>
828+
struct invoke_impl {
829+
KERNEL_FLOAT_INLINE static Output call(F fun, Args... args) {
830+
return fun(args...);
831+
}
832+
};
833+
827834
//
828835
template<typename Policy, typename F, size_t N, typename Output, typename... Args>
829836
struct apply_fallback_impl {
@@ -853,13 +860,6 @@ template<int Level, typename F, size_t N, typename Output, typename... Args>
853860
struct apply_fallback_impl<approx_level_policy<Level>, F, N, Output, Args...>:
854861
apply_impl<approx_policy, F, N, Output, Args...> {};
855862

856-
template<typename F, typename Output, typename... Args>
857-
struct invoke_impl {
858-
KERNEL_FLOAT_INLINE static Output call(F fun, Args... args) {
859-
return fun(args...);
860-
}
861-
};
862-
863863
// Only for `accurate_policy` do we implement `apply_impl`, the others will fall back to `apply_base_impl`.
864864
template<typename F, size_t N, typename Output, typename... Args>
865865
struct apply_impl<accurate_policy, F, N, Output, Args...> {
@@ -1416,7 +1416,7 @@ KERNEL_FLOAT_DEFINE_UNARY_FUN_FAST(rsqrt)
14161416
}
14171417

14181418
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp, __expf(input))
1419-
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp2, __exp2f(input))
1419+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp2, __exp2f(input)) // Seems to be missing?
14201420
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, exp10, __exp10f(input))
14211421

14221422
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, log, __logf(input))
@@ -1442,19 +1442,21 @@ KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN(float, tan, __tanf(input))
14421442
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(double, rcp, "rcp.approx.ftz.f64", "d")
14431443
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(double, rsqrt, "rsqrt.approx.f64", "d")
14441444

1445+
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, exp2, "ex2.approx.f32", "f")
14451446
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sqrt, "sqrt.approx.f32", "f")
14461447
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, rcp, "rcp.approx.f32", "f")
14471448
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, rsqrt, "rsqrt.approx.f32", "f")
14481449
KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, tanh, "tanh.approx.f32", "f")
1450+
1451+
// These are no longer necessary due to the KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_FUN above
1452+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sin, "sin.approx.f32", "f")
1453+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, cos, "cos.approx.f32", "f")
1454+
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, log2, "lg2.approx.f32", "f")
14491455
#endif
14501456

14511457
#define KERNEL_FLOAT_FAST_F32_MAP(F) \
14521458
F(exp) F(exp2) F(exp10) F(log) F(log2) F(log10) F(sin) F(cos) F(tan) F(rcp) F(rsqrt) F(sqrt)
14531459

1454-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, sin, "sin.approx.f32", "f")
1455-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, cos, "cos.approx.f32", "f")
1456-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, exp2, "ex2.approx.f32", "f")
1457-
//KERNEL_FLOAT_DEFINE_UNARY_FAST_IMPL_PTX(float, log2, "lg2.approx.f32", "f")
14581460
#else
14591461
#define KERNEL_FLOAT_FAST_F32_MAP(F)
14601462
#endif

0 commit comments

Comments
 (0)