Skip to content

Commit

Permalink
Merge #800
Browse files Browse the repository at this point in the history
800: Use wrapping addition for JEC r=cuviper a=cuviper

32-bit targets only have 12 bits in the atomic counters to represent the Jobs Event Counter (JEC). This should be fine with wrapping addition, but commit a0efb4a changed from wrapping `fetch_add` to a plain `+`, which is a checked addition in debug builds. We simply need to make this an explicit `wrapping_add` instead.

In theory, 64-bit targets had a problem too, but 44 bits for JEC is pretty good headroom in debug mode.

Fixes #797.

Co-authored-by: Josh Stone <cuviper@gmail.com>
  • Loading branch information
bors[bot] and cuviper committed Sep 17, 2020
2 parents 4a26ac4 + 596ac46 commit 8c9ada2
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 84 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/ci.yaml
Expand Up @@ -71,7 +71,7 @@ jobs:
rust: [stable, nightly]
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Install
uses: actions-rs/toolchain@v1
with:
Expand All @@ -90,13 +90,45 @@ jobs:
command: test
args: --verbose --package rayon-demo

i686:
name: Test (ubuntu-latest, stable-i686)
runs-on: ubuntu-latest
steps:
- name: System install
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: stable-i686-unknown-linux-gnu
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- name: Test rayon
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --package rayon
- name: Test rayon-core
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --package rayon-core

# wasm won't actually work without threading, but it builds
wasm:
name: WebAssembly
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Install
uses: actions-rs/toolchain@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -19,7 +19,7 @@ members = ["rayon-demo", "rayon-core"]
exclude = ["ci"]

[dependencies]
rayon-core = { version = "1.8.0", path = "rayon-core" }
rayon-core = { version = "1.8.1", path = "rayon-core" }
crossbeam-deque = "0.7.2"

# This is a public dependency!
Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
@@ -1,3 +1,9 @@
# Release rayon-core 1.8.1 (2020-09-17)

- Fixed an overflow panic on high-contention workloads, for a counter that was
meant to simply wrap. This panic only occurred with debug assertions enabled,
and was much more likely on 32-bit targets.

# Release rayon 1.4.0 / rayon-core 1.8.0 (2020-08-24)

- Implemented a new thread scheduler, [RFC 5], which uses targeted wakeups for
Expand Down
1 change: 1 addition & 0 deletions bors.toml
@@ -1,6 +1,7 @@
status = [
"Check (1.31.0)",
"Test (ubuntu-latest, stable)",
"Test (ubuntu-latest, stable-i686)",
"Test (ubuntu-latest, beta)",
"Test (ubuntu-latest, nightly)",
"Test (windows-latest, stable)",
Expand Down

0 comments on commit 8c9ada2

Please sign in to comment.