Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.physics > #896356
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | sci.logic, comp.lang.prolog, sci.physics |
| Subject | Source of the benchmark for DmitryVyukov (Was: capacity = 2^n for some n / systolic system) |
| Date | 2026-07-21 01:44 +0200 |
| Message-ID | <113mbsk$4kvj$5@solani.org> (permalink) |
| References | (3 earlier) <113m3q9$5496$2@solani.org> <113m6l8$561a$2@solani.org> <113mbjh$4kvj$2@solani.org> <113mbkr$4kvj$3@solani.org> <113mbn8$4kvj$4@solani.org> |
Cross-posted to 3 groups.
private static final int WORK = 8192;
private static final int NECK = 128;
private static void producer(Queue q) {
for (int i = 0; i < WORK; i++) {
Integer val = Integer.valueOf(i);
while (!enqueue(q, val)) ;
}
}
private static void consumer(Queue q) {
for (;;) {
Integer val;
while ((val = (Integer) dequeue(q)) == null) ;
if (val.intValue() == WORK-1)
break;
}
}
public static void main(String[] args) throws InterruptedException {
Queue q = new Queue();
init(q, NECK);
long tms = System.currentTimeMillis();
Thread[] threads = new Thread[4];
for (int i = 0; i < 4; i++) {
Thread thread;
if (i < 2) {
thread = new Thread(() -> producer(q));
} else {
thread = new Thread(() -> consumer(q));
}
threads[i] = thread;
thread.start();
}
for (int i = 0; i < 4; i++) {
Thread thread = threads[i];
thread.join();
}
System.out.println((System.currentTimeMillis() - tms)+" ms");
}
Mild Shock schrieb:
> Hi,
>
> I am still singing this song:
>
> "I'm a spinner, I'm a sinner
> I spin on CAS loops for my dinner
> Some call it busy-wait, I call it fate
> When the queue is empty, I just rotate"
>
> In Dmitry Vyukov multiple producer and
> multiple consuer, the assumption is
> that the capacity is a multiple power
>
> of 2. This way some inveriants hold
> computing seq - pos, even of the i32
> arithmetc overflows, the difference
>
> will still be in the interval -capacity
> ... capacity , as the AI chat bot explained
> me. The initialization of a Dmitry Vyukov
>
> then doesn't store capacity itself, but
> a mask derived from capacity:
>
> private static void init(Queue q, int size) {
> q.bufferMask = size - 1;
> q.sequences = new AtomicIntegerArray(size);
> for (int i = 0; i < size; i++)
> q.sequences.set(i, i);
> q.data = new Object[size];
> q.enqueuePos = new AtomicInteger(0);
> q.dequeuePos = new AtomicInteger(0);
> }
>
> I cannot use imageAtomicAdd, which wouldn't
> have a finite capacity. But as you see
> I have already a prototype of a Queue
>
> with a finite capacity. And the results
> for a systolic system are quite good:
>
> public class DmitryVyukov
> 8 ms
> public class DougLea
> 10 ms
>
> Have Fun!
>
> Bye
>
> Mild Shock schrieb:
>> Hi,
>>
>> imageAtomicAdd is trivial, but it does
>> not help with bounded buffers. I already
>> did imageAtomicAdd, in an experiment,
>>
>> where pi-WAM implemented an in and out
>> buffer as follows in Java, which can
>> be trivially ported to WebGPU / WGSL,
>>
>> by using atomic(i32) and AtomicAdd:
>>
>> private static final class PiChan {
>> private int[] buf;
>> private AtomicInteger pos;
>> }
>>
>> private static final class PiWam {
>> private PiChan in;
>> Etc...
>> }
>>
>> case 5: /* in */
>> int at = pi.in.pos.getAndAdd(obj);
>> for (int i = 0; i < obj; i++)
>> pi.state[offset + i] = pi.in.buf[at + i];
>> return 0;
>>
>> But this is not the same like Dmitry
>> Vyukov buffer. Which has a maximum
>> capacity, and fails to go beyond this
>>
>> capacity filling a buffer by a producer,
>> before a consumer made the buffer not
>> full again. My requirement for pi-WAM
>>
>> are bounded buffers with a finite capacity.
>>
>> Bye
>>
>> Mild Shock schrieb:
>>> Hi,
>>>
>>> But I am nowhere using WebGL / GLSL.
>>> The experiment here GPU versus CPU,
>>> was done with WebGPU / WGSL:
>>>
>>> 11.4 Giga Lips with a Budget Laptop
>>> https://github.com/Jean-Luc-Picard-2021/gigabudget
>>>
>>> Parallel π-WAM: 1.7 Giga Lips on a CPU
>>> https://medium.com/2989/8a984e75af44
>>>
>>> I do not intend to redo the experiment
>>> "gigabudget" with WebGL / GSLS. It would
>>> appear to me like flogging a dead horse,
>>>
>>> a technology that has reached EOL, namely
>>> OpenGL which is in the phase of end of lifetime.
>>>
>>> Bye
>>>
>>> Mild Shock schrieb:
>>>> Hi,
>>>>
>>>> I am developing against WebGPU / WGSL.
>>>> An overview of WebGPU / WGSL is found here:
>>>>
>>>> https://github.com/webgpu/webgpufundamentals
>>>>
>>>> There is no imageAtomicAdd in WGSL.
>>>> imageAtomicAdd is from WebGL / GLSL.
>>>>
>>>> These are two different things:
>>>>
>>>> WebGPU / WGSL : Wrapper for Vulcan, Direct 12, or Metal
>>>> WebGL / GLSL : Wrapper for OpenGL
>>>>
>>>> Chris M. Thomasson schrieb:
>>>> > imageAtomicAdd is a damn good one for accumulation buffers.
>>>>
>>>> Mild Shock schrieb:
>>>>> Hi,
>>>>>
>>>>> I didn't find Futex in WebGPU / WGSL.
>>>>> The website WebGPU fundamentals is on
>>>>> GitHub. I did a search here:
>>>>>
>>>>> https://github.com/webgpu/webgpufundamentals
>>>>>
>>>>> In Java I can use Doug Leas queue.
>>>>> In WebGPU / WGSL I will mostlikely
>>>>> adopt Dmitry Vyukov , for a first stab.
>>>>>
>>>>> Who is Doug lea?
>>>>>
>>>>> He wrote Concurrent Programming in
>>>>> Java: Design Principles and Patterns
>>>>> https://en.wikipedia.org/wiki/Doug_Lea
>>>>>
>>>>> He is behind most of the concurrency promitives
>>>>> in Java. Including the array backed queue that
>>>>> I tested. Remember the results I had:
>>>>>
>>>>> public class DmitryVyukov
>>>>> 8 ms
>>>>> public class DougLea
>>>>> 10 ms
>>>>>
>>>>> Bye
>>>
>>
>
Back to sci.physics | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I'm a spinner, I'm a sinner [Dmitry Vyukov for pi-WAM] (Re: Paul Tarau versus Mr. Taskmanager, who would win? [A PDP-11 Humunkulus from 1979] Mild Shock <janburse@fastmail.fm> - 2026-07-19 11:55 +0200
Gemini, DeepSeek, OpenAI all know Dmitriy V'jukov (Re: I'm a spinner, I'm a sinner [Dmitry Vyukov for pi-WAM]) Mild Shock <janburse@fastmail.fm> - 2026-07-20 08:33 +0200
The Cache Identity Crisis by Micro Penis (Re: Gemini, DeepSeek, OpenAI all know Dmitriy V'jukov) Mild Shock <janburse@fastmail.fm> - 2026-07-20 13:54 +0200
Just RTFM the RDNA 3.5 specs! [GPU Cache Lines] (Re: The Cache Identity Crisis by Micro Penis) Mild Shock <janburse@fastmail.fm> - 2026-07-20 14:10 +0200
The large memory tax: ECC RAM (Re: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines]) Mild Shock <janburse@fastmail.fm> - 2026-07-20 14:23 +0200
Re: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines] (Re: The Cache Identity Crisis by Micro Penis) Ross Finlayson <ross.a.finlayson@gmail.com> - 2026-07-20 12:26 -0700
Re: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines] (Re: The Cache Identity Crisis by Micro Penis) R Kym Horsell <kymhorsell@gmail.com> - 2026-07-20 22:20 +0000
Friendly Reminder: GPU 10x more performant than CPU (Was: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines]) Mild Shock <janburse@fastmail.fm> - 2026-07-21 00:39 +0200
Breaking the CUDA edge in AI by WebGPU (Was: Friendly Reminder: GPU 10x more performant than CPU) Mild Shock <janburse@fastmail.fm> - 2026-07-21 00:56 +0200
Like WebAssembly before it, WebGPU has "escaped" the browser. (Was: Breaking the CUDA edge in AI by WebGPU) Mild Shock <janburse@fastmail.fm> - 2026-07-21 01:05 +0200
If you are paranoid you can use Falco [Agentic AI] (Re: Like WebAssembly before it, WebGPU has "escaped" the browser.) Mild Shock <janburse@fastmail.fm> - 2026-07-21 22:57 +0200
What would an EMACS guru say [Windows Recall] (Re: If you are paranoid you can use Falco [Agentic AI]) Mild Shock <janburse@fastmail.fm> - 2026-07-21 23:35 +0200
Decide what you critique tiny winy penis (Re: What would an EMACS guru say [Windows Recall]) Mild Shock <janburse@fastmail.fm> - 2026-07-22 08:17 +0200
How confused is tiny winy penis? (Was: Decide what you critique tiny winy penis) Mild Shock <janburse@fastmail.fm> - 2026-07-22 08:28 +0200
Maybe change your hobby, become a dog owner? (Was: How confused is tiny winy penis?) Mild Shock <janburse@fastmail.fm> - 2026-07-22 09:37 +0200
Even dogs know Switzerland != Germany [Syphilis Brain Micro Penis] (Re: Decide what you critique tiny winy penis ) Mild Shock <janburse@fastmail.fm> - 2026-07-22 11:19 +0200
node.js has also Worker isolation , headless (Was: Even dogs know Switzerland != Germany [Syphilis Brain Micro Penis]) Mild Shock <janburse@fastmail.fm> - 2026-07-22 11:29 +0200
Abyss hobby interpretation vs. professional understanding [Keep up with the Kardashians] (Re: node.js has also Worker isolation , headless) Mild Shock <janburse@fastmail.fm> - 2026-07-22 11:38 +0200
Play stupid games, win classic Usenet prizes [CCCP Troll] (Re: Abyss hobby interpretation vs. professional understanding [Keep up with the Kardashians]) Mild Shock <janburse@fastmail.fm> - 2026-07-22 12:16 +0200
Glue Sniffing 5-Year Old Moron [CCCP Troll] (Was: Play stupid games, win classic Usenet prizes [CCCP Troll]) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:29 +0200
My Swift Go 16 AI has no IMEI, are you nuts? (Re: Even dogs know Switzerland != Germany [Syphilis Brain Micro Penis]) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:15 +0200
Same nickname and email, could post faster [5 year old moron] (Re: My Swift Go 16 AI has no IMEI, are you nuts? ) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:25 +0200
I have nothing to hide, you can find me in search.ch (Re: My Swift Go 16 AI has no IMEI, are you nuts?) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:41 +0200
Where did I confirm German via .ch, you are more than nuts! (Re: I have nothing to hide, you can find me in search.ch) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:48 +0200
Ask a Ukrainian Neighbour to do Detective [CCCP Troll] (Re: Where did I confirm German via .ch, you are more than nuts! ) Mild Shock <janburse@fastmail.fm> - 2026-07-22 14:51 +0200
Re: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines] (Re: The Cache Identity Crisis by Micro Penis) Ross Finlayson <ross.a.finlayson@gmail.com> - 2026-07-20 21:36 -0700
rossy boy is going paranoid (Was: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines]) Mild Shock <janburse@fastmail.fm> - 2026-07-21 09:01 +0200
Re: rossy boy is going paranoid (Was: Just RTFM the RDNA 3.5 specs! [GPU Cache Lines]) Ross Finlayson <ross.a.finlayson@gmail.com> - 2026-07-21 00:56 -0700
L1,..,Ln caches are located on the CPU AND on the GPU (Was: The Cache Identity Crisis by Micro Penis( Mild Shock <janburse@fastmail.fm> - 2026-07-20 19:35 +0200
GPU Cache Hierarchy: Understanding L1, L2, and VRAM (Was: L1,..,Ln caches are located on the CPU AND on the GPU) Mild Shock <janburse@fastmail.fm> - 2026-07-20 19:40 +0200
Well thats good, co-location, onto the same processor die (Re: GPU Cache Hierarchy: Understanding L1, L2, and VRAM (Was: L1,..,Ln caches are located on the CPU AND on the GPU) Mild Shock <janburse@fastmail.fm> - 2026-07-20 22:02 +0200
Where is micro penis mental error? (Re: Well thats good, co-location, onto the same processor die (Re: GPU Cache Hierarchy: Understanding L1, L2, and VRAM (Was: L1,..,Ln caches are located on the CPU AND on the GPU) Mild Shock <janburse@fastmail.fm> - 2026-07-20 22:07 +0200
I didn't find Futex in WebGPU / WGSL (Re: Gemini, DeepSeek, OpenAI all know Dmitriy V'jukov) Mild Shock <janburse@fastmail.fm> - 2026-07-20 23:26 +0200
There is no imageAtomicAdd in WGSL (Re: I didn't find Futex in WebGPU / WGSL) Mild Shock <janburse@fastmail.fm> - 2026-07-21 00:15 +0200
OpenGL is dead. Apple said bye bye / Wayland Compositor (Re: There is no imageAtomicAdd in WGSL) Mild Shock <janburse@fastmail.fm> - 2026-07-21 00:26 +0200
Flogging a Dead Horse, OpenGL is EOL (Re: There is no imageAtomicAdd in WGSL) Mild Shock <janburse@fastmail.fm> - 2026-07-21 01:39 +0200
imageAtomicAdd trivial, Dmitry Vyukov requires capacity (Re: Flogging a Dead Horse, OpenGL is EOL) Mild Shock <janburse@fastmail.fm> - 2026-07-21 01:40 +0200
capacity = 2^n for some n / systolic system (Re: imageAtomicAdd trivial, Dmitry Vyukov requires capacity) Mild Shock <janburse@fastmail.fm> - 2026-07-21 01:41 +0200
Source of the benchmark for DmitryVyukov (Was: capacity = 2^n for some n / systolic system) Mild Shock <janburse@fastmail.fm> - 2026-07-21 01:44 +0200
Re: There is no imageAtomicAdd in WGSL (Re: I didn't find Futex in WebGPU / WGSL) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-07-20 16:59 -0700
I never used OpenGL Version 4.2 and later (Was: There is no imageAtomicAdd in WGSL) Mild Shock <janburse@fastmail.fm> - 2026-07-21 08:47 +0200
Because of MIMD you have to reassess algorithms (Re: I never used OpenGL Version 4.2 and later) Mild Shock <janburse@fastmail.fm> - 2026-07-21 09:02 +0200
Why MIMD is interesting for pi-WAM? Mild Shock <janburse@fastmail.fm> - 2026-07-21 09:18 +0200
Re: Because of MIMD you have to reassess algorithms (Re: I never used OpenGL Version 4.2 and later) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-07-22 13:34 -0700
Do you see the loops, in C code and in Java code? /** Looping **/ (Was: Because of MIMD you have to reassess algorithms) Mild Shock <janburse@fastmail.fm> - 2026-07-23 00:09 +0200
Re: Do you see the loops, in C code and in Java code? /** Looping **/ (Was: Because of MIMD you have to reassess algorithms) Mild Shock <janburse@fastmail.fm> - 2026-07-23 00:53 +0200
Re: Do you see the loops, in C code and in Java code? /** Looping **/ (Was: Because of MIMD you have to reassess algorithms) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-07-22 18:00 -0700
Re: Do you see the loops, in C code and in Java code? /** Looping **/ (Was: Because of MIMD you have to reassess algorithms) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-07-22 18:20 -0700
Why do you even need a mpmc queue? [Thunder Kittens] (Was: Do you see the loops, in C code and in Java code? /** Looping **/) Mild Shock <janburse@fastmail.fm> - 2026-07-24 14:44 +0200
What does pi in pi-WAM mean? (Re: Why do you even need a mpmc queue? [Thunder Kittens]) Mild Shock <janburse@fastmail.fm> - 2026-07-24 14:53 +0200
OR-parallelism or AND-parallelism? [MapReduce] (Was: What does pi in pi-WAM mean?) Mild Shock <janburse@fastmail.fm> - 2026-07-24 15:00 +0200
csiph-web