Skip to content

Commit

Permalink
Various fixups after backporting dependency upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
fknorr committed Dec 9, 2024
1 parent c8ed188 commit ecd9469
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 29 deletions.
4 changes: 3 additions & 1 deletion examples/convolution/convolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});

Expand Down
2 changes: 1 addition & 1 deletion examples/wave_sim/wave_sim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions include/cool_region_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

#include "grid.h"

// NOCOMMIT
#define FMT_HEADER_ONLY
#include <spdlog/fmt/fmt.h>
#include <fmt/format.h>

namespace celerity {
namespace detail {
Expand Down
7 changes: 7 additions & 0 deletions include/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "ranges.h"

#include <fmt/ostream.h>

namespace celerity {
namespace detail {

Expand Down Expand Up @@ -53,3 +55,8 @@ namespace detail {

} // namespace detail
} // namespace celerity


template <size_t Dims> struct fmt::formatter<celerity::detail::GridPoint<Dims>> : ostream_formatter {};
template <size_t Dims> struct fmt::formatter<celerity::detail::GridBox<Dims>> : ostream_formatter {};
template <size_t Dims> struct fmt::formatter<celerity::detail::GridRegion<Dims>> : ostream_formatter {};
2 changes: 1 addition & 1 deletion include/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <typeinfo>

#include <CL/sycl.hpp>
#include <spdlog/fmt/fmt.h>
#include <fmt/format.h>

#include "buffer.h"
#include "cgf_diagnostics.h"
Expand Down
4 changes: 2 additions & 2 deletions include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <utility>
#include <variant>

#include <spdlog/fmt/ostr.h> // Enable formatting of types that support operator<<(std::ostream&, T)
#include <fmt/ostream.h>
#include <spdlog/spdlog.h>

#include "print_utils.h"
Expand Down Expand Up @@ -81,7 +81,7 @@ struct fmt::formatter<celerity::detail::log_map<Es...>> {
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }

template <typename FormatContext>
auto format(const celerity::detail::log_map<Es...>& map, FormatContext& ctx) {
auto format(const celerity::detail::log_map<Es...>& map, FormatContext& ctx) const {
auto&& out = ctx.out();
int i = 0;
tuple_for_each_pair(map.entries, [&i, &out](auto& a, auto& b) {
Expand Down
27 changes: 27 additions & 0 deletions include/print_utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#pragma once

#include "ranges.h"
#include "types.h"

#include <fmt/format.h>
#include <fmt/ostream.h>

namespace celerity {

Expand All @@ -20,3 +24,26 @@ std::ostream& operator<<(std::ostream& os, subrange<Dims> 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<celerity::detail::TYPE_ALIAS> : fmt::formatter<celerity::detail::TYPE_ALIAS::underlying_t> {};

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 <int Dims> struct fmt::formatter<celerity::chunk<Dims>> : ostream_formatter {};
template <int Dims> struct fmt::formatter<celerity::subrange<Dims>> : ostream_formatter {};
2 changes: 1 addition & 1 deletion include/range_mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <type_traits>

#include <CL/sycl.hpp>
#include <spdlog/fmt/fmt.h>
#include <fmt/ostream.h>

#include "ranges.h"

Expand Down
2 changes: 1 addition & 1 deletion include/tracy.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <optional>
#include <vector>

#include <spdlog/fmt/fmt.h>
#include <fmt/format.h>
#include <tracy/Tracy.hpp>
#include <tracy/TracyC.h>

Expand Down
4 changes: 2 additions & 2 deletions src/print_graph.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "print_graph.h"

#include <spdlog/fmt/fmt.h>
#include <spdlog/fmt/ostr.h>
#include <fmt/format.h>
#include <fmt/ostream.h>

#include "command.h"
#include "command_graph.h"
Expand Down
2 changes: 1 addition & 1 deletion src/print_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <spdlog/spdlog.h>

#include <spdlog/fmt/ostr.h>
#include <fmt/format.h>

namespace celerity {
namespace detail {
Expand Down
2 changes: 1 addition & 1 deletion src/worker_job.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "worker_job.h"

#include <spdlog/fmt/fmt.h>
#include <fmt/format.h>

#include "buffer_manager.h"
#include "device_queue.h"
Expand Down
12 changes: 0 additions & 12 deletions test/device_selection_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,11 @@ struct mock_device {
return *m_platform;
}

#if CELERITY_WORKAROUND(ACPP) || CELERITY_WORKAROUND(COMPUTECPP) // old API: device enum
template <sycl::info::device Param>
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 <typename Param>
auto get_info() const {
if constexpr(std::is_same_v<Param, sycl::info::device::name>) { return m_name; }
if constexpr(std::is_same_v<Param, sycl::info::device::device_type>) { return m_type; }
}
#endif

dt get_type() const { return m_type; }

Expand Down Expand Up @@ -85,11 +77,7 @@ struct mock_platform {
return m_devices;
}

#if CELERITY_WORKAROUND(ACPP) || CELERITY_WORKAROUND(COMPUTECPP) // old API: platform enum
template <sycl::info::platform Param>
#else // new API: platform tag type
template <typename Param>
#endif
std::string get_info() const {
return m_name;
}
Expand Down
2 changes: 1 addition & 1 deletion test/distributed_graph_generation_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/ndvbuffer_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ecd9469

Please sign in to comment.