Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html).

## [WIP]

This release is WIP

### Fixed

- Re-enable Windows support by fixing a range of Windows-specific and dependency-related issues (#336)

## [0.7.0] - 2025-08-18

This release includes changes that may require adjustments when upgrading:
Expand Down
1 change: 1 addition & 0 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <concepts>
#include <cstddef>
#include <functional>
#include <iterator>
#include <string>
#include <string_view>
#include <type_traits>
Expand Down
15 changes: 15 additions & 0 deletions include/workaround.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

#include <sycl/sycl.hpp>

#ifdef _WIN32
// Prevent Windows headers from polluting global namespace with min/max macros.
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#endif


#if CELERITY_SYCL_IS_DPCPP
#define CELERITY_WORKAROUND_DPCPP 1
Expand Down Expand Up @@ -47,9 +57,14 @@
#if __has_cpp_attribute(no_unique_address) // C++20, but implemented as an extension for earlier standards in Clang
#define CELERITY_DETAIL_HAS_NO_UNIQUE_ADDRESS true
#define CELERITY_DETAIL_NO_UNIQUE_ADDRESS [[no_unique_address]]
#elif __has_cpp_attribute(msvc::no_unique_address)
#define CELERITY_DETAIL_HAS_NO_UNIQUE_ADDRESS true
#define CELERITY_DETAIL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
#else
#define CELERITY_DETAIL_HAS_NO_UNIQUE_ADDRESS false
#define CELERITY_DETAIL_NO_UNIQUE_ADDRESS
#warning \
"Compiler does not support [[no_unique_address]] or equivalent, which may lead to incorrect behavior of 0-dimensional accessors and other edge cases where empty base optimization is required for correct layout. Random failures and crashes may occur."
#endif

#if CELERITY_ACCESSOR_BOUNDARY_CHECK
Expand Down
2 changes: 1 addition & 1 deletion src/backend/sycl_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct sycl_backend::impl {
sycl::context sycl_context;
std::vector<sycl::queue> queues;
std::optional<detail::thread_queue> submission_thread;
std::atomic_flag active_async_error_check = false;
std::atomic_flag active_async_error_check; // since c++20 atomic_flag is set to clear by default (false)

device_state() = default;
explicit device_state(const sycl::device& dev) : sycl_device(dev), sycl_context(sycl_device) {}
Expand Down
2 changes: 1 addition & 1 deletion src/dry_run_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "instruction_graph.h"
#include "log.h"
#include "named_threads.h"

#include "pilot.h"

namespace celerity::detail {

Expand Down
62 changes: 57 additions & 5 deletions src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,76 @@

#include <fmt/format.h>

#if !defined(_MSC_VER)
#if __has_include(<cxxabi.h>)
// Required for kernel name demangling in Clang
#include <cxxabi.h>
#endif


namespace celerity::detail::utils {

#if !__has_include(<cxxabi.h>)
static std::string msvc_undecorate_type_name(std::string s) {
static constexpr const char* ptr_suffixes[] = {
" * __ptr64",
" * __ptr32",
" *",
" & __ptr64",
" &",
" && __ptr64",
" &&",
};
for(const char* suffix : ptr_suffixes) {
std::string_view sv(suffix);
if(s.size() >= sv.size() && s.compare(s.size() - sv.size(), sv.size(), sv) == 0) {
s.erase(s.size() - sv.size());
break;
}
}

static constexpr const char* cv_suffixes[] = {
" const volatile",
" volatile",
" const",
};
for(const char* suffix : cv_suffixes) {
std::string_view sv(suffix);
if(s.size() >= sv.size() && s.compare(s.size() - sv.size(), sv.size(), sv) == 0) {
s.erase(s.size() - sv.size());
break;
}
}

static constexpr const char* prefixes[] = {
"class ",
"struct ",
"union ",
"enum ",
};
for(const char* prefix : prefixes) {
std::string_view sv(prefix);
if(s.compare(0, sv.size(), sv) == 0) {
s.erase(0, sv.size());
break;
}
}

return s;
}
#endif

std::string get_simplified_type_name_from_pointer(const std::type_info& pointer_type_info) {
#if !defined(_MSC_VER)
// This type of demangling can be done if the abi header is available. This also works for Clang on Windows, if
// compiled with Itanium ABI on Windows (e.g. MinGW/MSYS2). MSVC
#if __has_include(<cxxabi.h>)
const std::unique_ptr<char, void (*)(void*)> demangle_buffer(abi::__cxa_demangle(pointer_type_info.name(), nullptr, nullptr, nullptr), std::free);
std::string demangled_type_name = demangle_buffer.get();
#else
std::string demangled_type_name = pointer_type_info.name();
#endif

// get rid of the pointer "*"
if(!demangled_type_name.empty() && demangled_type_name.back() == '*') { demangled_type_name.pop_back(); }
#else
std::string demangled_type_name = msvc_undecorate_type_name(pointer_type_info.name());
#endif

if(demangled_type_name.length() < 2) return demangled_type_name;
bool templated = false;
Expand Down
1 change: 1 addition & 0 deletions test/accessor_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <catch2/matchers/catch_matchers_string.hpp>

#include <celerity.h>
#include <vector>

#include "test_utils.h"

Expand Down
4 changes: 4 additions & 0 deletions test/runtime_tests.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef _WIN32
// pthread isn't available on Windows; only include on Unix-like systems
#else
#include <pthread.h>
#endif

#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_test_macros.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <catch2/reporters/catch_reporter_registrars.hpp>

#include <spdlog/details/os.h>
#include <spdlog/sinks/ansicolor_sink.h>
#include <spdlog/sinks/ansicolor_sink-inl.h> // we need this inl as windows has problems with the non-inlined version
#include <spdlog/sinks/sink.h>

namespace celerity::test_utils_detail {
Expand Down
Loading