eclipse-iceoryx / eclipse-iceoryx/iceoryx

32-Bit Support

Open
#2,301 4 comments 0 reactions 1 assignee Claimed by @elBoberido View on GitHub
enhancement
Dominant language
C++
Stars
2.2k
Forks
492
Avg merge
18h 57m
Merged PRs (30d)
1

Description

## Brief feature description

The main reason iceoryx is not running on 32-Bit CPUs are the lock-free algorithms. Our implementations rely on 8 byte (64 bit) CAS operations being lock-free. However, currently available 32bit CPUs often support 8 byte CAS.

The goal is to get iceoryx running on the [Kria KR260 Robotics Starter Kit](https://www.amd.com/en/products/system-on-modules/kria/k26/kr260-robotics-starter-kit.html)

## Detailed information

### godbolt example with 64 bit data type

- [x86-64](https://godbolt.org/z/hd6TssebW)
- [x86-64 with '-m32' flag](https://godbolt.org/z/E1z3xcxM8)
- [arm64 with '-mtune=cortex-a53' flag](https://godbolt.org/z/xfedfzWTK)
- [arm64 with '-mtune=cortex-a53 -mabi=lp64' flags](https://godbolt.org/z/qs8cKnxh9)
- [arm64 with '-mtune=cortex-a53 -mabi=ilp32' flags](https://godbolt.org/z/cKPaPPGhj)
- [arm with '-mtune=cortex-a53' flag](https://godbolt.org/z/Kr8nMa4cv)
- [arm with '-mtune=cortex-r5' flag](https://godbolt.org/z/abs3fxqKb)

### Additional hurdles

- The `UsedChunkList` stores its data as 64 bit values and uses an atomic flag for synchronization for RouDi in case an application dies. With 32 bit CPUs this can lead to torn writes. These torn writes need to be detected when RouDi cleans up the remainder of a dead process.
- There are a ton on warnings, e.g. `usize_t` is smaller than `uint64_t` on 32 bit

### Additional information

- [C/C++11 mappings to processors - University of Cambridge](https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html)

## Tasks

- [x] Implement #2329 to ensure that all lock-free algorithms perform the C++17 `std::atomic::is_always_lock_free` with a `static_assert` to prevent compilation on targets which do not support the atomic data type without a process local lock
- [x] Fix all warnings on 32 bit
- [x] Implement provisional 32<->64 bit mixed-mode support
- [x] Implement spin-lock semaphore for condition variable
- [x] Implement spin-lock mutex for locking policy
- [ ] Implement production-ready 32<->64 bit mixed-mode support on Linux and Windows
- [ ] Implement futex-based semaphore and mutex on Linux
- [ ] Implement WaitOnAddressBased semaphore and mutes on Windows
- [ ] Adjust the `UsedChunkList` for torn-reads and torn-writes on 32 bit

## Related issues

- #562

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.