Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions include/kernel_float/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,6 @@ vector_ptr(T*) -> vector_ptr<T, 1, access_policy<T>>;

template<typename T>
vector_ptr(const T*) -> vector_ptr<T, 1, access_policy<const T>>;

#if __cpp_deduction_guides >= 201907L
template<typename T>
vec_ptr(T*) -> vec_ptr<T, 1>;

template<typename T>
vec_ptr(const T*) -> vec_ptr<T, 1, const T>;
#endif
#endif

} // namespace kernel_float
Expand Down
12 changes: 0 additions & 12 deletions include/kernel_float/prelude.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ static constexpr kconstant<long long int> operator""_c(unsigned long long int v)
return static_cast<long long int>(v);
}

// Deduction guides for aliases are only supported from C++20
#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907L
template<typename T>
kscalar(T&&) -> kscalar<decay_t<T>>;

template<typename... Args>
kvec(Args&&...) -> kvec<promote_t<Args...>, sizeof...(Args)>;

template<typename T>
kconstant(T&&) -> kconstant<decay_t<T>>;
#endif

} // namespace prelude
} // namespace kernel_float

Expand Down
6 changes: 0 additions & 6 deletions include/kernel_float/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,6 @@ KERNEL_FLOAT_INLINE vec<promote_t<Args...>, sizeof...(Args)> make_vec(Args&&...
// Deduction guide for `vector`
template<typename... Args>
vector(Args&&... args) -> vector<promote_t<Args...>, extent<sizeof...(Args)>>;

// Deduction guides for aliases are only supported from C++20
#if __cpp_deduction_guides >= 201907L
template<typename... Args>
vec(Args&&... args) -> vec<promote_t<Args...>, sizeof...(Args)>;
#endif
#endif

} // namespace kernel_float
Expand Down
30 changes: 2 additions & 28 deletions single_include/kernel_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

//================================================================================
// this file has been auto-generated, do not modify its contents!
// date: 2026-08-28 13:42:54.102829
// git hash: 14a94fbc188ca3285e7351e5bb79184ce89c75d7
// date: 2026-09-25 19:45:19.408615
// git hash: 5226c9232b45c090be46c41e17034c089ffbf8d0
//================================================================================

#ifndef KERNEL_FLOAT_MACROS_H
Expand Down Expand Up @@ -3710,14 +3710,6 @@ vector_ptr(T*) -> vector_ptr<T, 1, access_policy<T>>;

template<typename T>
vector_ptr(const T*) -> vector_ptr<T, 1, access_policy<const T>>;

#if __cpp_deduction_guides >= 201907L
template<typename T>
vec_ptr(T*) -> vec_ptr<T, 1>;

template<typename T>
vec_ptr(const T*) -> vec_ptr<T, 1, const T>;
#endif
#endif

} // namespace kernel_float
Expand Down Expand Up @@ -4571,12 +4563,6 @@ KERNEL_FLOAT_INLINE vec<promote_t<Args...>, sizeof...(Args)> make_vec(Args&&...
// Deduction guide for `vector`
template<typename... Args>
vector(Args&&... args) -> vector<promote_t<Args...>, extent<sizeof...(Args)>>;

// Deduction guides for aliases are only supported from C++20
#if __cpp_deduction_guides >= 201907L
template<typename... Args>
vec(Args&&... args) -> vec<promote_t<Args...>, sizeof...(Args)>;
#endif
#endif

} // namespace kernel_float
Expand Down Expand Up @@ -5788,18 +5774,6 @@ static constexpr kconstant<long long int> operator""_c(unsigned long long int v)
return static_cast<long long int>(v);
}

// Deduction guides for aliases are only supported from C++20
#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907L
template<typename T>
kscalar(T&&) -> kscalar<decay_t<T>>;

template<typename... Args>
kvec(Args&&...) -> kvec<promote_t<Args...>, sizeof...(Args)>;

template<typename T>
kconstant(T&&) -> kconstant<decay_t<T>>;
#endif

} // namespace prelude
} // namespace kernel_float

Expand Down
47 changes: 47 additions & 0 deletions tests/deduction.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <type_traits>

#include "common.h"
#include "kernel_float/prelude.h"

// Class template argument deduction. These checks are compile-time only: if this file compiles,
// they pass. The file is valid as both C++17 and C++20.

namespace deduction_tests {
using namespace kernel_float::prelude;

struct packed3 {
float x, y, z; // sizeof(packed3) != alignof(packed3)
};

__host__ __device__ void class_templates(float* fp, const packed3* cp) {
kf::vector v(1, 2.0f);
static_assert(std::is_same<decltype(v), kf::vec<float, 2>>::value, "");

kf::vector_ptr p(fp);
static_assert(
std::is_same<decltype(p), kf::vector_ptr<float, 1, kf::access_policy<float>>>::value,
"");

kf::vector_ptr q(cp);
using expected_q = kf::vector_ptr<packed3, 1, kf::access_policy<const packed3>>;
static_assert(std::is_same<decltype(q), expected_q>::value, "");

kf::constant c(2.0);
static_assert(std::is_same<decltype(c), kf::constant<double>>::value, "");
}

// From C++20, the compiler derives deduction guides for alias templates from those of the class
// template they name.
#if __cplusplus >= 202002L
__host__ __device__ void alias_templates() {
kf::scalar s(1.5);
static_assert(std::is_same<decltype(s), kf::scalar<double>>::value, "");

kscalar ks(1.5f);
static_assert(std::is_same<decltype(ks), kscalar<float>>::value, "");

kconstant kc(2.0);
static_assert(std::is_same<decltype(kc), kconstant<double>>::value, "");
}
#endif
} // namespace deduction_tests
Loading