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

group functions warning: implicit conversion from 'unsigned long long' to 'float' changes value from 18446744073709551615 to 18446744073709551616 #852

Open
AlexeySachkov opened this issue Jan 9, 2024 · 0 comments

Comments

@AlexeySachkov
Copy link
Contributor

AlexeySachkov commented Jan 9, 2024

template <typename T, typename U, typename I, typename OpT>
struct JointScanDataStruct {
JointScanDataStruct(size_t range_size, OpT op, bool with_init)
: ref_input(range_size), res(range_size * 4, U(-1)) {
std::iota(ref_input.begin(), ref_input.end(), T(1));
if constexpr (std::is_same_v<OpT, sycl::multiplies<I>> ||
std::is_same_v<OpT, sycl::plus<I>>) {
auto identity = sycl::known_identity_v<OpT, I>;
auto acc = with_init ? I{init} : identity;
for (size_t i = 0; i < range_size; ++i) {
I tmp = op(I(acc), I(ref_input[i]));
if (tmp > std::numeric_limits<U>::max()) {
ref_input[i] = identity;
}
acc = op(acc, ref_input[i]);
}
}
}

Build log:

[1154/1195] Building CXX object tests/group_functions/CMakeFiles/test_group_functions_objects.dir/group_joint_scan_unsigned_short.cpp.o
In file included from tests/group_functions/group_joint_scan_unsigned_short.cpp:29:
../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'unsigned long long' to 'float' changes value from 18446744073709551615 to 18446744073709551616 [-Wimplicit-const-int-float-conversion]
   71 |         if (tmp > std::numeric_limits<U>::max()) {
      |                 ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tests/group_functions/group_scan.h:145:37: note: in instantiation of member function 'JointScanDataStruct<unsigned short, unsigned long long, float, std::multiplies<float>>::JointScanDataStruct' requested here
  145 |   JointScanDataStruct<T, U, I, OpT> host_data{size, op, with_init};
      |                                     ^
../tests/group_functions/group_scan.h:281:9: note: in instantiation of function template specialization 'check_scan<3, unsigned short, unsigned long long, float, std::multiplies<float>>' requested here
  281 |         check_scan<D, T, U, I>(queue, size, executionRange, OperatorT(),
      |         ^
../tests/group_functions/type_coverage.h:505:3: note: in instantiation of member function 'init_joint_scan_group<std::integral_constant<int, 3>, unsigned short, unsigned long long, float, std::multiplies<float>>::operator()' reques
ted here
  505 |   Action<ActionArgsT...>{}(std::forward<HeadT>(head),
      |   ^
../tests/group_functions/type_coverage.h:522:5: note: in instantiation of function template specialization 'for_all_combinations<init_joint_scan_group, std::integral_constant<int, 3>, unsigned short, unsigned long long, float, std:
:multiplies<float>, sycl::queue &, const std::basic_string<char> &, true>' requested here
  522 |   ((for_all_combinations<Action, ActionArgsT..., HeadTypes>(
      |     ^
../tests/group_functions/group_scan.h:293:5: note: in instantiation of function template specialization 'for_all_combinations<init_joint_scan_group, std::integral_constant<int, 3>, unsigned short, unsigned long long, float, std::pl
us<float>, std::multiplies<float>, sycl::logical_and<float>, sycl::logical_or<float>, sycl::minimum<float>, sycl::maximum<float>, sycl::queue &>' requested here
  293 |     for_all_combinations<init_joint_scan_group, DimensionT, T, U, I>(operators,
      |     ^
../tests/group_functions/type_coverage.h:505:3: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
  505 |   Action<ActionArgsT...>{}(std::forward<HeadT>(head),
      |   ^
../tests/group_functions/type_coverage.h:553:5: note: in instantiation of function template specialization 'for_all_combinations<invoke_init_joint_scan_group, std::integral_constant<int, 3>, unsigned short, unsigned long long, floa
t, sycl::queue &, true>' requested here
  553 |   ((for_all_combinations<Action, ActionArgsT..., HeadTypes>(
      |     ^

Other affected data types:

../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'long long' to 'float' changes value from 9223372036854775807 to 9223372036854775808
../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'unsigned long' to 'float' changes value from 18446744073709551615 to 18446744073709551616
../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808
../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296
../tests/group_functions/group_scan.h:71:19: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant