Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings are errors #4075

Merged
merged 29 commits into from
Aug 10, 2021
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
07b557f
Enable warnings as errors and fix all current warnings
harrism Jul 21, 2021
74fadac
Merge branch 'branch-21.08' into fix-cuml-warnings-as-errors
harrism Jul 21, 2021
694a038
Merge branch 'branch-21.10' into fix-cuml-warnings-as-errors
harrism Jul 21, 2021
1d73c48
Use is_nan
harrism Jul 21, 2021
6ae8fae
std::size_t
harrism Jul 22, 2021
0ba156f
Eliminate #pragma unroll warnings
harrism Jul 22, 2021
173311c
Don't ignore unknown pragma warnings anymore.
harrism Jul 22, 2021
eb3373d
Respond to review feedback, std::size_t, include cstddef
harrism Jul 27, 2021
d48cf6c
Add `detail::bit_cast`
harrism Jul 27, 2021
bf8bf32
Merge branch 'branch-21.10' into fix-cuml-warnings-as-errors
harrism Jul 28, 2021
fea66f6
Fix new warning in rf_test.cu
harrism Jul 28, 2021
07f1efe
Merge branch 'branch-21.10' into fix-cuml-warnings-as-errors
harrism Aug 3, 2021
5f065fd
Fix warning in runner.cuh
harrism Aug 3, 2021
80c572a
Enable CUDA device code warnings are errors.
harrism Aug 3, 2021
06b44b1
Fix warning in contingencyMatrix.cuh
harrism Aug 3, 2021
60f04e6
Use size_t in batched matrix class.
harrism Aug 3, 2021
0d6c8e8
More auto
harrism Aug 3, 2021
fed871f
Next warnings fix...
harrism Aug 4, 2021
7a83c7d
NVCC Warnings as errors only for 11.2+
harrism Aug 4, 2021
4d82043
Another fix
harrism Aug 4, 2021
3a6a24f
More fixes in csr.cuh
harrism Aug 4, 2021
e1aee79
Next attempt
harrism Aug 4, 2021
1506dce
Temporarily disable -Werror
harrism Aug 4, 2021
d3ac9b9
Fix uninitialized variables.
harrism Aug 5, 2021
df2c6e2
Fix more warnings
harrism Aug 5, 2021
32939d2
Re-enable -Werror
harrism Aug 5, 2021
71bb6d5
Update cpp/cmake/modules/ConfigureCUDA.cmake
harrism Aug 7, 2021
b9bfa80
Remove unused parameter name.
harrism Aug 9, 2021
da342bf
Merge branch 'fix-cuml-warnings-as-errors' of github.com:harrism/cuml…
harrism Aug 9, 2021
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
Prev Previous commit
Next Next commit
Add detail::bit_cast
harrism committed Jul 27, 2021
commit d48cf6c60b8d81b53ec2d20b560fe1384dd89a54
32 changes: 18 additions & 14 deletions cpp/src_prims/stats/minmax.cuh
Original file line number Diff line number Diff line change
@@ -24,6 +24,20 @@
namespace MLCommon {
namespace Stats {

namespace detail {

// TODO: replace with `std::bitcast` once we adopt C++20 or libcu++ adds it
template <class To, class From>
constexpr To bit_cast(const From& from) noexcept
{
To to{};
static_assert(sizeof(To) == sizeof(From));
memcpy(&to, &from, sizeof(To));
return to;
}

} // namespace detail

template <typename T>
struct encode_traits {
};
@@ -40,36 +54,26 @@ struct encode_traits<double> {

HDI int encode(float val)
{
int i{};
static_assert(sizeof(i) == sizeof(val));
memcpy(&i, &val, sizeof(i)); // int i = *(int*)&val;
int i = detail::bit_cast<int>(val);
return i >= 0 ? i : (1 << 31) | ~i;
}

HDI long long encode(double val)
{
std::int64_t i{};
static_assert(sizeof(i) == sizeof(val));
memcpy(&i, &val, sizeof(i)); // long long i = *(long long*)&val;
std::int64_t i = detail::bit_cast<std::int64_t>(val);
return i >= 0 ? i : (1ULL << 63) | ~i;
}

HDI float decode(int val)
{
if (val < 0) val = (1 << 31) | ~val;
float f{};
static_assert(sizeof(f) == sizeof(val));
memcpy(&f, &val, sizeof(f));
return f;
return detail::bit_cast<float>(val);
}

HDI double decode(long long val)
{
if (val < 0) val = (1ULL << 63) | ~val;
double d{};
static_assert(sizeof(d) == sizeof(val));
memcpy(&d, &val, sizeof(d));
return d;
return detail::bit_cast<double>(val);
}

template <typename T, typename E>