Skip to content

Adding synchronization and threading primitives - #3294

Merged
benvanik merged 4 commits into
mainfrom
benvanik-task-primitives
Oct 12, 2020
Merged

benvanik merged 4 commits into
mainfrom
benvanik-task-primitives

Conversation

@benvanik

@benvanik benvanik commented Sep 29, 2020 •

Copy link
Copy Markdown
Collaborator

These will be used to implement the task system used to execute CPU kernels. The mutex benchmarks show we are faster than std::mutex (due to some limitations we can accept) and we now have complete control over any cross-thread blocking behavior we want to introduce (to favor latency vs. power consumption, etc).

This is compatible with Windows, iOS/MacOS (following the Apple performance/power guidelines), Android/Linux, wasm/emscripten, and fallbacks for normal pthreads usage on other platforms. I've only optimized Windows right now but the other platforms shouldn't require much tweaking and when they do we have a benchmark to do it with.

Progress on #49.
Fixes #1482.

@benvanik benvanik added runtime Relating to the IREE runtime library performance ⚡ Performance/optimization related work across the compiler and runtime labels Sep 29, 2020
@benvanik benvanik added this to the 2020Q3 Core milestone Sep 29, 2020
@google-cla google-cla Bot added the cla: yes label Sep 29, 2020
@benvanik
benvanik force-pushed the benvanik-task-primitives branch 8 times, most recently from f044c9c to d170a82 Compare September 30, 2020 03:15
@benvanik
benvanik changed the base branch from benvanik-cpuid to main September 30, 2020 03:38
@benvanik
benvanik force-pushed the benvanik-task-primitives branch from d170a82 to c92a1d5 Compare September 30, 2020 03:39
@benvanik benvanik modified the milestones: 2020Q3 Core, 2020Q4 Core Oct 1, 2020
@benvanik
benvanik force-pushed the benvanik-task-primitives branch from c92a1d5 to 42024b2 Compare October 1, 2020 22:25
@benvanik
benvanik requested a review from ScottTodd October 1, 2020 22:28
@benvanik
benvanik force-pushed the benvanik-task-primitives branch 4 times, most recently from acc06fd to 906e8fe Compare October 1, 2020 23:26
@benvanik
benvanik marked this pull request as ready for review October 1, 2020 23:30
@benvanik
benvanik force-pushed the benvanik-task-primitives branch from 906e8fe to 326c4f1 Compare October 1, 2020 23:55
@benvanik benvanik mentioned this pull request Oct 2, 2020
6 tasks done
Comment thread iree/base/atomics.h Resolved
Comment thread iree/base/atomics.h Resolved
Comment thread iree/base/synchronization.h Resolved
Comment thread iree/base/synchronization.h Resolved
Comment thread iree/base/synchronization.c Resolved
Comment thread iree/base/synchronization.c Resolved
Comment thread iree/base/synchronization.c Resolved
Comment thread iree/base/synchronization.c Resolved
Comment thread iree/base/synchronization.c Resolved
Includes tracy instrumentation for iree_mutex_t.

Benchmark results from my desktop:
https://gist.github.com/benvanik/b9f601b173d18d17bdd1d3fc784d55de
(this is using the futex iree_slim_mutex_t which is surprisingly close
to the SRW-based iree_mutex_t, but since SRW is better I'm checking that
in as the default)
This is the foundation of the task system thread pool and exposes
functionality required for usage in that context. The surface is kept
small to avoid needing large platform-dependent implementations.
@benvanik
benvanik force-pushed the benvanik-task-primitives branch from 326c4f1 to 76b67c2 Compare October 12, 2020 17:09
@benvanik
benvanik merged commit 173e3a6 into main Oct 12, 2020
@benvanik
benvanik deleted the benvanik-task-primitives branch October 12, 2020 17:40
@ScottTodd ScottTodd mentioned this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance ⚡ Performance/optimization related work across the compiler and runtime runtime Relating to the IREE runtime library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tracy mutex annotations

2 participants