From ecd946964ca9b3b48efc0ac6093a6e0d103741b0 Mon Sep 17 00:00:00 2001 From: Fabian Knorr Date: Mon, 9 Dec 2024 13:53:08 +0100 Subject: [PATCH] Various fixups after backporting dependency upgrades --- examples/convolution/convolution.cc | 4 +++- examples/wave_sim/wave_sim.cc | 2 +- include/cool_region_map.h | 4 +--- include/grid.h | 7 ++++++ include/handler.h | 2 +- include/log.h | 4 ++-- include/print_utils.h | 27 ++++++++++++++++++++++ include/range_mapper.h | 2 +- include/tracy.h | 2 +- src/print_graph.cc | 4 ++-- src/print_utils.cc | 2 +- src/worker_job.cc | 2 +- test/device_selection_tests.cc | 12 ---------- test/distributed_graph_generation_tests.cc | 2 +- test/ndvbuffer_tests.cc | 4 ++-- 15 files changed, 51 insertions(+), 29 deletions(-) diff --git a/examples/convolution/convolution.cc b/examples/convolution/convolution.cc index 03928b77f..9b3972a23 100644 --- a/examples/convolution/convolution.cc +++ b/examples/convolution/convolution.cc @@ -101,7 +101,9 @@ int main(int argc, char* argv[]) { sum -= in[{item[0] + 1, item[1]}]; sum -= in[{item[0], item[1] - 1}]; sum -= in[{item[0], item[1] + 1}]; - out[item] = fmin(float3(1.f, 1.f, 1.f), sum); + out[item].x() = sycl::fmin(1.f, sum.x()); + out[item].y() = sycl::fmin(1.f, sum.y()); + out[item].z() = sycl::fmin(1.f, sum.z()); }); }); diff --git a/examples/wave_sim/wave_sim.cc b/examples/wave_sim/wave_sim.cc index c6c09c1ff..312ed65c1 100644 --- a/examples/wave_sim/wave_sim.cc +++ b/examples/wave_sim/wave_sim.cc @@ -296,7 +296,7 @@ int main(int argc, char* argv[]) { fmt::print("Time: {}ms ({:.2f} GB/s) ({:.2f} GigaCells/s)\n", dt / 1000, gbs, (cfg.N * cfg.N * (cfg.T / cfg.dt) / 1000.0) / dt); if(cfg.N * cfg.N * sizeof(DataT) < 10ull * 1024 * 1024 * 1024) { - queue.submit([=](celerity::handler& cgh) { + queue.submit([&](celerity::handler& cgh) { celerity::accessor acc{u, cgh, celerity::access::all{}, celerity::read_only_host_task}; cgh.host_task(celerity::on_master_node, [=]() { hasher hsh; diff --git a/include/cool_region_map.h b/include/cool_region_map.h index 94ef4d58e..de8b6dde3 100644 --- a/include/cool_region_map.h +++ b/include/cool_region_map.h @@ -20,9 +20,7 @@ #include "grid.h" -// NOCOMMIT -#define FMT_HEADER_ONLY -#include +#include namespace celerity { namespace detail { diff --git a/include/grid.h b/include/grid.h index a6976cd0f..450a9fda3 100644 --- a/include/grid.h +++ b/include/grid.h @@ -6,6 +6,8 @@ #include "ranges.h" +#include + namespace celerity { namespace detail { @@ -53,3 +55,8 @@ namespace detail { } // namespace detail } // namespace celerity + + +template struct fmt::formatter> : ostream_formatter {}; +template struct fmt::formatter> : ostream_formatter {}; +template struct fmt::formatter> : ostream_formatter {}; diff --git a/include/handler.h b/include/handler.h index 244087bed..73fdffcc7 100644 --- a/include/handler.h +++ b/include/handler.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include "buffer.h" #include "cgf_diagnostics.h" diff --git a/include/log.h b/include/log.h index 13b9454c8..76778322e 100644 --- a/include/log.h +++ b/include/log.h @@ -6,7 +6,7 @@ #include #include -#include // Enable formatting of types that support operator<<(std::ostream&, T) +#include #include #include "print_utils.h" @@ -81,7 +81,7 @@ struct fmt::formatter> { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template - auto format(const celerity::detail::log_map& map, FormatContext& ctx) { + auto format(const celerity::detail::log_map& map, FormatContext& ctx) const { auto&& out = ctx.out(); int i = 0; tuple_for_each_pair(map.entries, [&i, &out](auto& a, auto& b) { diff --git a/include/print_utils.h b/include/print_utils.h index a25a2c564..8f2937b9b 100644 --- a/include/print_utils.h +++ b/include/print_utils.h @@ -1,6 +1,10 @@ #pragma once #include "ranges.h" +#include "types.h" + +#include +#include namespace celerity { @@ -20,3 +24,26 @@ std::ostream& operator<<(std::ostream& os, subrange subr) { } } // namespace celerity + +// TODO prefix type aliases like in GDB pretty_printers (requires removing explicit prefixes elsewhere in the code) +#define CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(TYPE_ALIAS) \ + template <> \ + struct fmt::formatter : fmt::formatter {}; + +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(task_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(buffer_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(node_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(command_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(collective_group_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(reduction_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(host_object_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(hydration_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(memory_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(device_id) +CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE(transfer_id) + +#undef CELERITY_DETAIL_IMPLEMENT_FMT_FORMATTER_FOR_PHANTOM_TYPE + + +template struct fmt::formatter> : ostream_formatter {}; +template struct fmt::formatter> : ostream_formatter {}; diff --git a/include/range_mapper.h b/include/range_mapper.h index 175fd5daa..12497c409 100644 --- a/include/range_mapper.h +++ b/include/range_mapper.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include "ranges.h" diff --git a/include/tracy.h b/include/tracy.h index aec4235dd..f68e80658 100644 --- a/include/tracy.h +++ b/include/tracy.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/src/print_graph.cc b/src/print_graph.cc index 17dc4d55b..476168e81 100644 --- a/src/print_graph.cc +++ b/src/print_graph.cc @@ -1,7 +1,7 @@ #include "print_graph.h" -#include -#include +#include +#include #include "command.h" #include "command_graph.h" diff --git a/src/print_utils.cc b/src/print_utils.cc index fc7c9cd51..24874d7c8 100644 --- a/src/print_utils.cc +++ b/src/print_utils.cc @@ -2,7 +2,7 @@ #include -#include +#include namespace celerity { namespace detail { diff --git a/src/worker_job.cc b/src/worker_job.cc index 0541a810d..e34f89d2a 100644 --- a/src/worker_job.cc +++ b/src/worker_job.cc @@ -1,6 +1,6 @@ #include "worker_job.h" -#include +#include #include "buffer_manager.h" #include "device_queue.h" diff --git a/test/device_selection_tests.cc b/test/device_selection_tests.cc index ca0816b75..9f28b41b0 100644 --- a/test/device_selection_tests.cc +++ b/test/device_selection_tests.cc @@ -28,19 +28,11 @@ struct mock_device { return *m_platform; } -#if CELERITY_WORKAROUND(ACPP) || CELERITY_WORKAROUND(COMPUTECPP) // old API: device enum - template - auto get_info() const { - if constexpr(Param == sycl::info::device::name) { return m_name; } - if constexpr(Param == sycl::info::device::device_type) { return m_type; } - } -#else // new API: device tag type template auto get_info() const { if constexpr(std::is_same_v) { return m_name; } if constexpr(std::is_same_v) { return m_type; } } -#endif dt get_type() const { return m_type; } @@ -85,11 +77,7 @@ struct mock_platform { return m_devices; } -#if CELERITY_WORKAROUND(ACPP) || CELERITY_WORKAROUND(COMPUTECPP) // old API: platform enum - template -#else // new API: platform tag type template -#endif std::string get_info() const { return m_name; } diff --git a/test/distributed_graph_generation_tests.cc b/test/distributed_graph_generation_tests.cc index 5e8b3eefe..d2b6bbbdb 100644 --- a/test/distributed_graph_generation_tests.cc +++ b/test/distributed_graph_generation_tests.cc @@ -229,7 +229,7 @@ class command_query { found = true; if(kind.has_value() && received.kind != *kind) { UNSCOPED_INFO(fmt::format("Expected command {} on node {} to have successor {} with kind {}, but found kind {}", cmd->get_cid(), - nid, expected->get_cid(), *kind, received.kind)); + nid, expected->get_cid(), (int) *kind, (int) received.kind)); return false; } } diff --git a/test/ndvbuffer_tests.cc b/test/ndvbuffer_tests.cc index 5d38b7a01..8c71b6b9e 100644 --- a/test/ndvbuffer_tests.cc +++ b/test/ndvbuffer_tests.cc @@ -274,8 +274,8 @@ TEST_CASE("WIP: why are returned pointers not 'UVA pointers' ?!") { fmt::print("Attributes of pointer {}:\n", ptr); fmt::print("\tcontext = {}\n", (void*)ctx); - fmt::print("\tmemtype = {}\n", memtype); - fmt::print("\tdevptr = {}\n", devptr); + fmt::print("\tmemtype = {}\n", (int)memtype); + fmt::print("\tdevptr = {}\n", (void*)devptr); // fmt::print("\thostptr = {}\n", hostptr); fmt::print("\tis_managed = {}\n", is_managed); fmt::print("\tdevice = {}\n", device_ordinal);