From 5fc98a6ba2d190d5998e1435ebaef2479ad327df Mon Sep 17 00:00:00 2001 From: Peter Thoman Date: Mon, 5 Feb 2024 12:05:00 +0100 Subject: [PATCH] Fix a variety of warnings in MSVC --- include/simsycl/detail/coordinate.hh | 2 +- include/simsycl/detail/group_operation_impl.hh | 2 +- include/simsycl/schedule.hh | 6 +++--- include/simsycl/sycl/sub_group.hh | 4 ++-- src/simsycl/schedule.cc | 8 ++++---- src/simsycl/system.cc | 2 +- test/hierarchical_tests.cc | 2 -- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/simsycl/detail/coordinate.hh b/include/simsycl/detail/coordinate.hh index f2ceaff..09c4729 100644 --- a/include/simsycl/detail/coordinate.hh +++ b/include/simsycl/detail/coordinate.hh @@ -168,7 +168,7 @@ class coordinate { template constexpr bool all_true(const coordinate &c) { bool result = true; - for(int d = 0; d < Dimensions; ++d) { result &= c[d]; } + for(int d = 0; d < Dimensions; ++d) { result = result && c[d]; } return result; } diff --git a/include/simsycl/detail/group_operation_impl.hh b/include/simsycl/detail/group_operation_impl.hh index 7cd2501..083a488 100644 --- a/include/simsycl/detail/group_operation_impl.hh +++ b/include/simsycl/detail/group_operation_impl.hh @@ -250,7 +250,7 @@ auto perform_group_operation(G g, group_operation_id id, const Spec &spec) { SIMSYCL_CHECK(new_op_index < group_instance.operations.size() && "group operation reached in unexpected order"); auto &op = group_instance.operations[ops_reached]; - check_group_op_validity(linear_id_in_group, new_op, op); + check_group_op_validity(static_cast(linear_id_in_group), new_op, op); if constexpr(requires(Spec::per_op_t &per_t, group_operation_data &op_t) { spec.reached(per_t, op_t); }) { spec.reached(dynamic_cast(*op.per_op_data), op); } else { diff --git a/include/simsycl/schedule.hh b/include/simsycl/schedule.hh index 9d71dec..7eb8309 100644 --- a/include/simsycl/schedule.hh +++ b/include/simsycl/schedule.hh @@ -9,7 +9,7 @@ namespace simsycl { class cooperative_schedule { public: - using state = uint64_t; + using state = unsigned int; cooperative_schedule() = default; cooperative_schedule(const cooperative_schedule &) = delete; @@ -31,13 +31,13 @@ class round_robin_schedule final : public cooperative_schedule { class shuffle_schedule final : public cooperative_schedule { public: shuffle_schedule() = default; - explicit shuffle_schedule(uint64_t seed) : m_seed(seed) {} + explicit shuffle_schedule(unsigned int seed) : m_seed(seed) {} [[nodiscard]] state init(std::vector &order) const override; [[nodiscard]] state update(state state_before, std::vector &order) const override; private: - uint64_t m_seed = 1234567890; + unsigned int m_seed = 1234567890; }; const cooperative_schedule &get_cooperative_schedule(); diff --git a/include/simsycl/sycl/sub_group.hh b/include/simsycl/sycl/sub_group.hh index ad0eac1..6a951f6 100644 --- a/include/simsycl/sycl/sub_group.hh +++ b/include/simsycl/sycl/sub_group.hh @@ -84,9 +84,9 @@ class sub_group { SIMSYCL_NOT_IMPLEMENTED_UNUSED_ARGS(x, init, op); } - linear_id_type get_group_linear_range() const { return m_group_range.size(); } + linear_id_type get_group_linear_range() const { return static_cast(m_group_range.size()); } - linear_id_type get_local_linear_range() const { return m_local_range.size(); } + linear_id_type get_local_linear_range() const { return static_cast(m_local_range.size()); } bool leader() const { return get_local_linear_id() == 0; } diff --git a/src/simsycl/schedule.cc b/src/simsycl/schedule.cc index 855d507..50fe79c 100644 --- a/src/simsycl/schedule.cc +++ b/src/simsycl/schedule.cc @@ -307,8 +307,8 @@ void cooperative_for_nd_range(const sycl::device &device, const sycl::nd_range(const sycl::device &device, const sycl::nd_range<1> &range, diff --git a/src/simsycl/system.cc b/src/simsycl/system.cc index f0a3b67..5216083 100644 --- a/src/simsycl/system.cc +++ b/src/simsycl/system.cc @@ -288,7 +288,7 @@ void parse_environment() { if(repr == "shuffle") return std::make_unique(); if(repr.starts_with("shuffle:")) { const auto seed_repr = repr.substr(strlen("shuffle:")); - return std::make_unique(env::default_parser{}(seed_repr)); + return std::make_unique(env::default_parser{}(seed_repr)); } throw env::parser_error{ fmt::format("Invalid schedule '{}', permitted values are 'rr', 'shuffle', and 'shuffle:'", repr)}; diff --git a/test/hierarchical_tests.cc b/test/hierarchical_tests.cc index 3ea7b38..90eb46a 100644 --- a/test/hierarchical_tests.cc +++ b/test/hierarchical_tests.cc @@ -85,8 +85,6 @@ TEST_CASE("Basic hierarchical parallel for functionality", SECTION("3D") { int test_total = 0; - constexpr int value = 7; - q.submit([&](handler &cgh) { // Issue 8 work-groups of 8 work-items each cgh.parallel_for_work_group(range<3>(2, 2, 2), range<3>(2, 2, 2), [=, &test_total](group<3> g) {