Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix task_alignment for ARM #1386

Closed
wants to merge 8 commits into from
12 changes: 10 additions & 2 deletions include/oneapi/tbb/detail/_task.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2020-2023 Intel Corporation
Copyright (c) 2020-2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -207,7 +207,11 @@ class task_traits {
};

//! Alignment for a task object
static constexpr std::size_t task_alignment = 64;
#if __ARM_ARCH_7A__ || __aarch64__
constexpr std::size_t task_alignment = 128;
#else /* Generic */
constexpr std::size_t task_alignment = 64;
#endif

//! Base class for user-defined tasks.
/** @ingroup task_scheduling */
Expand All @@ -220,7 +224,11 @@ class alignas(task_alignment) task : public task_traits {
virtual task* cancel(execution_data&) = 0;

private:
#if __ARM_ARCH_7A__ || __aarch64__
std::uint64_t m_reserved[14]{};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i decided to put #if here, instead of (task_alignment - sizeof(void*) - sizeof(task_traits)) / sizeof(std::uint64_t), because it gets weird on architectures where pointer isn't 8 bytes? idk, this seems cleaner than it was before

#else /* Generic */
std::uint64_t m_reserved[6]{};
#endif
friend struct r1::task_accessor;
};
static_assert(sizeof(task) == task_alignment, "task size is broken");
Expand Down
Loading