Repository navigation
Conversation
4 tasks done
wtc::queue<T> is unbounded and its push never fails, so a substitute has to be too. A fixed ring must either drop an item when full or wait for the consumer, and waiting deadlocks a program in which one thread is both the producer and the consumer, which an SPSC verdict allows. This one is a linked list of fixed-size blocks. Each block counts the slots the producer has published, with release; the consumer frees a block only after draining it and acquiring its successor, and publishing the successor is the producer's last access to the block. Its push and try_pop have the same signatures as wtc::queue<T>'s, so the lowering does not change shape. Its annotations are its own, so lifting never mistakes calls to the substitute for calls to the shim. The stress test checks order, count and sum at block sizes 1, 4 and 1024, and that items left at destruction are destroyed exactly once. CI builds the runtime headers standalone and runs the test under ThreadSanitizer. Verified: the stress test passes, unsanitized, with Apple clang on arm64. Not yet verified under TSan: sanitizers are broken in that toolchain (an empty program built with -fsanitize=thread segfaults), so the Linux CI job is the first TSan run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZweZeya
force-pushed
the
feat/dialect-verification
branch
from
October 18, 2026 05:20
99d62be to
ad2187d
Compare
ZweZeya
force-pushed
the
feat/spsc-runtime
branch
from
October 18, 2026 05:20
b3ee0aa to
93a5287
Compare
Collaborator
|
Closing as superseded by #10, which already had an unbounded block ring ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #5 (
feat/dialect-verification).What this changes
Adds
runtime/spsc_queue.hpp, the substitute for awtc::queue<T>proven SPSC. It is unbounded, like the queue it replaces, so the substitution is exact: a bounded ring would have to drop an item or wait when full, and waiting deadlocks a program where one thread both produces and consumes, which an SPSC verdict allows. Blocks of fixed size are linked; the consumer frees a block only after draining it and acquiring its successor, and publishing the successor is the producer's last access to it. Signatures matchwtc::queue<T>'s; its annotations are its own (wtc_impl_spsc_*), so lifting never mistakes the substitute for the shim.CI's shim job now also compiles the runtime headers standalone and runs
runtime/test/spsc_stress.cppunder ThreadSanitizer.How it was checked
The stress test checks order, count and sum at block sizes 1, 4 and 1024, and that items left at destruction are destroyed exactly once. It passes:
-fsanitize=threadsegfaults), so CI is the only TSan run.Checklist
🤖 Generated with Claude Code