Skip to content

Commit

Permalink
Fix a variety of warnings in MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterTh committed Feb 5, 2024
1 parent 28a74bb commit 5fc98a6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/simsycl/detail/coordinate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class coordinate {
template<typename Interface, int Dimensions>
constexpr bool all_true(const coordinate<Interface, Dimensions> &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;
}

Expand Down
2 changes: 1 addition & 1 deletion include/simsycl/detail/group_operation_impl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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<typename Spec::per_op_t &>(*op.per_op_data), op);
} else {
Expand Down
6 changes: 3 additions & 3 deletions include/simsycl/schedule.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<size_t> &order) const override;
[[nodiscard]] state update(state state_before, std::vector<size_t> &order) const override;

private:
uint64_t m_seed = 1234567890;
unsigned int m_seed = 1234567890;
};

const cooperative_schedule &get_cooperative_schedule();
Expand Down
4 changes: 2 additions & 2 deletions include/simsycl/sycl/sub_group.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<linear_id_type>(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<linear_id_type>(m_local_range.size()); }

bool leader() const { return get_local_linear_id() == 0; }

Expand Down
8 changes: 4 additions & 4 deletions src/simsycl/schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ void cooperative_for_nd_range(const sycl::device &device, const sycl::nd_range<D

// adjust local memory pointers before switching fibers
const auto concurrent_group_idx = concurrent_global_idx / local_linear_range;
for(size_t i = 0; i < local_memory.size(); ++i) {
*local_memory[i].ptr = concurrent_groups[concurrent_group_idx].local_memory_allocations[i].get();
for(size_t j = 0; j < local_memory.size(); ++j) {
*local_memory[j].ptr = concurrent_groups[concurrent_group_idx].local_memory_allocations[j].get();
}

fibers[concurrent_global_idx] = fibers[concurrent_global_idx].resume();
}
schedule_state = schedule.update(schedule_state, order);
}

// rethrow any encountered exceptions
for(auto &exception : caught_exceptions) { std::rethrow_exception(exception); }
// rethrow the first encountered exception
if(!caught_exceptions.empty()) { std::rethrow_exception(caught_exceptions.front()); }
}

template void cooperative_for_nd_range<1>(const sycl::device &device, const sycl::nd_range<1> &range,
Expand Down
2 changes: 1 addition & 1 deletion src/simsycl/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void parse_environment() {
if(repr == "shuffle") return std::make_unique<shuffle_schedule>();
if(repr.starts_with("shuffle:")) {
const auto seed_repr = repr.substr(strlen("shuffle:"));
return std::make_unique<shuffle_schedule>(env::default_parser<uint64_t>{}(seed_repr));
return std::make_unique<shuffle_schedule>(env::default_parser<unsigned int>{}(seed_repr));
}
throw env::parser_error{
fmt::format("Invalid schedule '{}', permitted values are 'rr', 'shuffle', and 'shuffle:<seed>'", repr)};
Expand Down
2 changes: 0 additions & 2 deletions test/hierarchical_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5fc98a6

Please sign in to comment.