← all posts
September 18, 2026·Ronald Adonyo· 12 min read

A barrier after every dispatch

Honeykrisp, Mesa's Vulkan driver for Apple silicon, emits a full GPU barrier and cache invalidate after every compute dispatch, whether or not anything depends on it. For a 4B model decoding on an M2 Ultra that is 547 barriers per token at 18 microseconds each, 52% of the time. Removing the barriers the application never requested is worth 20.7% with correctness unchanged. A per-bit ablation shows one unnamed bit carries the entire cost, and the 2x ceiling from removing it computes garbage.

547barriers per token
+20.7%shipped, correct
20.7 µsspent by one bit
infperplexity without it
15937/16613test-backend-ops
vulkanmesaapple-siliconasahillama.cppgpubenchmarking
Yellow jerry cans queued along a red-earth path beside a white yard wall, with a low wooden gate after every second can; a colobus monkey watches from a tulip tree above and a crested crane at the right looks along the empty end of the path.
Was called
52% of decode time
Was
a barrier after every dispatch

A ⁠Mac ​Studio ‌running ‌Linux ‌decodes ​a ​4B ‌model ‌on ​its ​GPU ​through ​Mesa's ​Vulkan ​driver. ‌Earlier ‌work ‌on ‌the ‌shader ‌compiler ‌turned ‌up ​three ​defects. ‌The ‌largest ​remaining ​cost ‌is ‌not ​in ​the ​compiler.

Honeykrisp ‌follows ‌every ​compute ‌dispatch ‌with ‌a ‌full ⁠AGX ⁠barrier ​and ‌cache ‌invalidate, ‌whether ​or ​not ‌anything ‌depends ​on ​it. ​On ​this ​model ​that ‌is ‌547 ‌dispatches ‌per ‌token ‌and ‌547 ‌barriers, ​at ​about ‌18 ‌microseconds ​each, ​which ‌is ‌52% ​of ​the ​time ‌to ‌produce ​a ‌token.

The ‌driver ‌documents ‌the ⁠reason ⁠in ​a ‌comment ‌quoted ‌below. ​Nobody ​knows ‌what ‌the ​bits ​in ​that ​packet ​mean, ​so ‌all ‌of ‌them ‌are ‌set ‌after ‌every ‌launch ​to ​be ‌safe.

Transcript

Honeykrisp, Mesa's Vulkan driver for Apple silicon, emits a full GPU barrier after every compute dispatch, whether or not anything depends on it.

Picture a dispatch line. Each press is a dispatch, and the carriage is one token's work. After every press, a stop pin rises. That's the barrier. The carriage waits there while the caches flush.

On a 4B model, that's 547 barriers per token, at about 18 microseconds each. That's 52 percent of the time to produce a token.

But llama.cpp already knows which operations overlap. Emit the barrier only where Vulkan asks, and a token needs 370, not 547.

Decode goes from 52.4 to 63.3 tokens per second. Plus 20.7 percent, with correctness unchanged.

Then there's the packet itself. Every bit in it was set, to be safe. Clear them one at a time, and bit 7 alone carries 14 of the 18 microseconds.

But bit 7 is required. Clear it, and decode looks healthy, at 111 tokens per second. But perplexity is infinite. It was computing garbage.

So the barrier goes only where Vulkan asks, and bit 7 stays set. Plus 20.7 percent, on by default. The full write-up is at boracode.ai.

The post in under two minutes: the dispatch line, the cost, the fix, and the one bit that matters. Narrated in Ronald's cloned voice.
Transcript

An M2 Ultra on Linux stops its GPU after every job.

That's over half the time of every token.

Nobody knows what the barrier bits mean, so the driver sets them all.

So Honeykrisp now stops only where Vulkan asks.

Twenty percent faster, and the test results don't change.

Then each bit got tested alone. One carries the whole cost.

Clear it, and the GPU runs almost twice as fast.

Except every answer comes out as infinity.

So a benchmark that only counts speed will cheer for garbage.

547 stops. Full write-up on boracode.ai. Webale.

The short version for phones: a Kampala taxi stage, where every stop pin is a barrier. Narrated in Ronald's own voice, cloned with VoxCPM2.

Test bench

One ‌machine. ​There ​is ‌no ‌PCIe ​link ​table ​because ‌the ‌GPU ​is ‌on ‌the ‌SoC.

host      Apple Mac Studio (M2 Ultra, 2023), apple,j475d / apple,t6022
          24 CPU cores, 190 GiB unified memory, 800 GB/s peak bandwidth
          Fedora Asahi Remix, kernel 7.1.13-usb4gpu (local backport)

GPU       apple,agx-t6022, via DRM_ASAHI. The Vulkan driver reports it
          as "Apple M2 Ultra (G14D B1)": uma 1, fp16 1, bf16 0,
          subgroup 32, shared memory 32768, integer dot product 0
driver    Mesa 26.1.5, Honeykrisp, built locally, with three local AGX
          compiler patches applied identically in every arm below
          vendorID 0x10005 (VK_VENDOR_ID_MESA), driverID
          VK_DRIVER_ID_MESA_HONEYKRISP

runtime   llama.cpp f5919bf (b10227), Vulkan backend
model     Qwen3-4B, Q4_0, 2369.8 MB of tensor data
          36 layers, hidden 2560, ffn 9728, GQA 32/8 x head_dim 128
          token_embd is q6_K and tied, so it is also the output head

harness   llama-bench -p 0 -n 32 -r 2, arms interleaved, warm floor
gate      test-backend-ops test -j 4, gated on its own summary line

Every ‌arm ⁠below ⁠runs ​the ‌same ‌binary ‌with ​one ​environment ‌variable ‌changed. ​The ​variable ​selects ​one ​branch ​in ‌the ‌driver ‌and ‌nothing ‌else ‌differs.

Where a token actually goes

The ‌baseline ‌is ​the ​fraction ‌of ‌the ​machine's ​own ‌800 ‌GB/s ​that ​the ​model ‌uses, ‌not ​a ‌ratio ‌against ‌another ‌vendor's ⁠hardware. ⁠At ​the ‌start ‌of ‌this ​work ​that ‌was ‌122 ​GB/s, ​or ​15.4%.

A ​token ​was ​decomposed ‌by ‌measuring ‌each ‌matrix-vector ‌shape ‌in ‌the ‌model ​on ​its ‌own:

test-backend-ops perf, n=1, q4_0. Times are per single matvec; the model runs each of these 36 times.
shapeper layerµsMBGB/s% of 800
9728 x 2560 (gate, up)270.3014.01199.324.9%
2560 x 9728 (down)174.2814.01188.623.6%
4096 x 2560 (q)144.265.90133.316.7%
2560 x 4096 (o)145.105.90130.816.3%
1024 x 2560 (k, v)226.971.4754.76.8%

Two ‌results ​follow ​from ‌the ‌table. ​First, ​bandwidth ​falls ‌as ‌the ​operation ‌shrinks. ‌That ‌pattern ‌indicates ⁠a ⁠fixed ​cost ‌per ‌operation ‌and ​not ​a ‌bandwidth ‌limit. ​Fitting ​time ​against ​bytes ​gives ​about ‌21.5 ‌microseconds ‌of ‌fixed ‌cost ‌and ‌282 ‌GB/s ​at ​the ‌margin.

Second, ‌the ​shapes ​sum ‌to ‌2049.9 ​MB ​while ​the ‌file ‌on ​disk ‌is ‌2369.8 ‌MB. ‌The ⁠missing ⁠320 ​MB ‌is ‌token_embd, ‌which ​this ​model ‌ties ‌to ​its ​output ​head. ​It ​is ​a ‌q6_K ‌matvec ‌of ‌151936 ‌x ‌2560 ‌that ‌reads ​319 ​MB ‌every ‌token, ​13.5% ​of ‌all ‌bytes, ​and ​the ​first ‌decomposition ‌omitted ​it. ‌Measured ‌alone ‌it ‌runs ⁠at ⁠369 ​GB/s, ‌46% ‌of ‌the ​part's ​peak. ‌It ‌is ​the ​fastest ​operation ​in ​the ​model, ‌which ‌shows ‌that ‌neither ‌the ‌hardware ‌nor ‌the ​kernel ​has ‌a ‌low ​ceiling.

Dispatches ​were ‌then ‌counted. ​The ​driver ​prints ‌the ‌counts ​under ‌ASAHI_MESA_DEBUG=perf. ‌That ‌is ‌a ⁠different ⁠variable ​from ‌AGX_MESA_DEBUG, ‌which ‌controls ​the ​compiler, ‌and ‌using ​the ​wrong ​one ​produces ​an ​empty ‌log:

Slope of totals at n=16 against n=8, so model load and warmup cancel.
quantityper token
queue submissions11
compute dispatches547
CDM barriers547

There ‌is ‌exactly ‌one ‌barrier ‌per ‌dispatch. ‌Combined ​with ​the ‌fit, ‌the ​token ​time ‌is ‌accounted ​for: ​547 ​x ‌21.5 ‌µs ​of ‌fixed ‌cost ‌is ‌11.76 ⁠ms, ⁠the ​weights ‌at ‌282 ‌GB/s ​are ​7.27 ‌ms, ‌and ​the ​sum ​is ​19.03 ​ms ​against ‌19.34 ‌ms ‌measured. ‌The ‌two ‌figures ‌were ‌derived ​independently ​and ‌agree ‌within ​2%.

The nobarrier flag does not remove the barrier

Honeykrisp ​ships ‌a ‌debug ​flag ​named ​nobarrier. ‌It ‌was ​the ‌first ‌test:

Interleaved, three repetitions each. Difference is 0.8%.
armtok/s
stock51.8
HK_PERFTEST=nobarrier52.2

The ‌flag ‌has ⁠no ⁠effect, ​and ‌concluding ‌from ‌it ​that ​barriers ‌are ‌irrelevant ​would ​be ​wrong.

HK_PERFTEST=nobarrier ​skips ​hk_CmdPipelineBarrier2, ​which ‌ends ‌the ‌compute ‌control ‌stream. ‌But ‌hk_EndCommandBuffer ‌runs ​merge_control_streams(), ​which ‌stitches ‌adjacent ​compute ​streams ‌back ‌together. ​The ​driver's ​own ‌comment ‌calls ​the ‌split ‌"sloppiness" ‌that ‌is ⁠cheap ⁠to ​undo ‌later. ‌The ‌flag ​therefore ​removes ‌a ‌split ​that ​is ​merged ​again ​anyway, ​and ‌it ‌never ‌touches ‌the ‌packet ‌that ‌serializes ‌the ​GPU.

Where the serialization happens

The ​serialization ‌is ‌in ​the ​dispatch ‌path ‌itself ​(src/asahi/vulkan/hk_cmd_dispatch.c):

c
void
hk_dispatch_with_usc_launch(struct hk_device *dev, struct hk_cs *cs, ...)
{
   hk_ensure_cs_has_space(cs->cmd, cs, 0x2000);
   cs->stats.cmds++;

   cs->current =
      agx_cdm_launch(cs->current, dev->dev.chip, grid, wg, launch, usc);

   hk_cdm_cache_flush(dev, cs);
}

hk_cdm_cache_flush ​emits ​an ‌AGX ‌CDM_BARRIER ​packet ‌after ‌every ‌launch, ‌unconditionally, ⁠without ⁠checking ​whether ‌anything ‌downstream ‌reads ​what ​the ‌launch ‌wrote. ​The ​packet ​is ​defined ​in ​src/asahi/libagx/libagx_dgc.h, ‌with ‌the ‌driver's ‌own ‌explanation:

c
static inline GLOBAL uint32_t *
agx_cdm_barrier(GLOBAL uint32_t *out, enum agx_chip chip)
{
   agx_push(out, CDM_BARRIER, cfg) {
      /* With multiple launches in the same CDM stream, we can get cache
       * coherency (? or sync?) issues. We hit this with blits, which need - in
       * between dispatches - need the PBE cache to be flushed and the texture
       * cache to be invalidated. Until we know what bits mean what exactly,
       * let's just set these after every launch to be safe. We can revisit in
       * the future when we figure out what the bits mean.
       */
      cfg.unk_0 = true;
      cfg.unk_1 = true;
      cfg.unk_2 = true;
      cfg.usc_cache_inval = true;
      cfg.unk_4 = true;
      /* ... through unk_19 ... */
   }
}

The ‌comment ‌explains ‌the ​design. ​The ‌hardware ‌is ​reverse-engineered ​and ‌undocumented, ‌so ​setting ​every ​bit ‌was ‌the ​safe ‌choice, ‌and ‌the ‌author ⁠recorded ⁠both ​the ‌reason ‌and ‌the ​intent ​to ‌revisit ‌it. ​The ​motivating ​case ​was ​blits, ​which ‌involve ‌the ‌pixel-backend ‌and ‌texture ‌caches. ‌That ‌is ​a ​graphics ‌path ‌unrelated ​to ​a ‌chain ‌of ​matrix-vector ​products.

The ​barrier ‌is ‌therefore ​emitted ‌too ‌often ‌and ‌is ⁠too ⁠wide. ​Each ‌half ‌can ‌be ​measured ​separately.

Upper bound

The ‌driver ‌has ​no ​switch ​for ​this, ​so ​one ‌was ‌added: ‌an ‌environment ‌variable ‌that ‌makes ‌hk_cdm_cache_flush ​return ​immediately. ‌It ‌is ​off ​by ‌default ‌and ​the ​stock ​path ‌is ‌byte-identical. ​Results ‌are ‌wrong ‌with ‌it ⁠set, ⁠which ​does ‌not ‌matter ‌here ​because ​the ‌measurement ‌is ​only ​of ​what ​the ​barrier ​costs.

Interleaved, three repetitions. The GPU survived; a plain run afterwards was normal.
armtok/scorrect
stock52.4yes
barrier skipped entirely109.0no

The ‌speedup ‌is ‌2.08x. ‌Spread ‌over ‌547 ‌barriers, ‌one ​barrier ​costs ‌18.1 ‌microseconds. ​The ​smallest ‌matvec ‌in ​the ​model ​takes ‌26.7 ‌µs ​in ‌total.

Two halves, measured separately

Frequency

The ‌barrier ‌belongs ‌where ⁠the ⁠application ​asks ‌for ‌ordering. ‌llama.cpp's ​Vulkan ​backend ‌already ‌tracks ​which ​operations ​alias. ​It ​compares ​byte ‌ranges ‌within ‌a ‌buffer ‌and ‌synchronizes ‌only ‌on ​a ​real ‌overlap, ‌so ​the ​number ‌of ‌barriers ​it ​requests ​is ‌the ‌number ​genuinely ‌needed:

vkCmdPipelineBarrier2 calls counted from the driver's own perf_debug line.
quantityper token
compute dispatches547
barriers Honeykrisp emitted547
barriers llama.cpp asked for366

The ‌change ‌emits ‌the ⁠barrier ⁠where ​the ‌Vulkan ‌API ‌asks ​for ​it. ‌Application ‌dispatches ​drop ​the ​unconditional ​flush. ​Driver-internal ​dispatches ‌(draws, ‌meta ‌operations, ‌queries, ‌and ‌the ‌blit ‌paths ​the ​comment ‌was ‌about) ​keep ​the ‌existing ‌behaviour ​exactly.

Placement ​matters. ​Every ‌synchronization ‌point ​in ‌the ‌driver ‌funnels ‌through ⁠hk_cmd_buffer_end_compute(): ⁠pipeline ​barriers, ‌vkCmdWaitEvents2, ‌vkCmdSetEvent2, ‌the ​query ​paths, ‌and ‌end ​of ​command ​buffer. ​The ​first ​version ‌emitted ‌the ‌barrier ‌at ‌only ‌two ‌of ‌these ​sites, ​which ‌left ‌an ​application ​that ‌orders ‌its ​compute ​with ​events ‌instead ‌of ​barriers ‌with ‌no ‌ordering ‌at ⁠all. ⁠Emitting ​it ‌in ‌end_compute ‌covers ​all ​eight ‌sites ‌by ​construction. ​It ​must ​be ​emitted ​before ‌the ‌stream ‌is ‌ended, ‌because ‌merge_control_streams() ‌may ‌rejoin ​that ​stream ‌and ‌only ​a ​barrier ‌inside ‌it ​survives ​the ​merge.

The ‌measured ‌effect:

Same binary, HK_LAZY_BARRIER=0 and =1. 370 rather than 366 because each command buffer also ends with one.
armdispatches/tokenbarriers/tokentok/s
stock54754752.5
barrier where Vulkan asks54737063.4
Six presses stand for the 547 dispatches in one token. Stock Honeykrisp raises a stop pin, one barrier, after every press. The shipped rule raises one only where llama.cpp asks for ordering: four of six here, against 370 of 547 measured. The holds at a pin (18.1 µs) and at a press (17.3 µs) are to scale with each other; travel between presses is not. The readout is the measured result.

Width

The ​second ‌half ‌is ‌the ‌packet. ⁠The ⁠bit ​pattern ‌was ‌made ‌settable ​and ​swept, ‌with ‌bit ​N ​of ​the ​mask ​mapped ​to ‌bit ‌N ‌of ‌the ‌packet, ‌so ‌the ‌stock ​pattern ​is ‌0x000fffff. ‌Speed ​first:

An empty CDM_BARRIER packet costs the same as no packet at all, so the cost is entirely the cache work the bits request.
masktok/s
0x000fffff (stock)52.4
0x0000ffff52.7
0x000000ff56.1
0x0000007f99.3
0x0000000f100.0
0x00000000 (empty packet)108.9

One ​bit ‌accounts ‌for ​almost ​all ​of ‌it. ‌Going ​from ‌0x7f ‌to ‌0xff ‌sets ⁠bit ⁠7 ​alone ‌and ‌drops ‌throughput ​from ​99.3 ‌tok/s ‌to ​56.1, ​a ​factor ​of ​1.77.

Speed ​is ‌not ‌the ‌acceptance ‌gate. ‌Correctness ‌is, ‌and ‌the ​same ​masks ‌run ‌against ​the ​test ‌suite ‌give:

Full suite, 16613 cases. Stock and the mask reproducing stock agree exactly, which is the control that makes the rest readable.
masktok/stest-backend-ops
0x000fffff (stock)52.415937/16613
0x000000ff56.115937/16613
0x000000f756.015937/16613
0x0000007f99.3segfault
0x0000003f99.3segfault
0x0000002f100.3segfault
0x0000001f-segfault
0x0000000f100.0segfault
0x00000000108.9segfault

Bit ​7 ​is ​load-bearing. ‌Every ‌mask ​that ‌clears ‌it ‌crashes ‌the ⁠process ⁠instead ​of ‌merely ‌computing ‌wrong ​values, ​which ‌indicates ‌it ​protects ​something ​structural. ​Bits ​8 ​through ‌19 ‌are ‌pure ‌cost: ‌dropping ‌them ‌is ‌worth ​7.0% ​with ‌the ‌suite ​unchanged. ​Bit ‌3, ‌usc_cache_inval, ​is ​not ​needed ‌for ‌this ​workload ‌(0xf7 ‌passes) ‌and ‌is ⁠nearly ⁠free ​anyway.

What shipped

llama-bench -p 0 -n 32 -r 2, arms interleaved, three repetitions of the full set, means across reps. test-backend-ops 15937/16613 on both arms, identical to stock. This is the default build with no flags set.
modelstockfixeddelta
Qwen3-4B Q4_052.4163.26+20.7%
Qwen3-4B Q4_K_M49.8658.40+17.1%

Narrowing ‌the ‌bit ‌pattern ​adds ​a ‌further ‌1.6 ​tok/s, ​reaching ​64.8 ​on ​Q4_0. ​That ‌figure ‌comes ‌from ‌a ‌build ‌carrying ‌the ‌sweep ​knob ​and ‌is ‌not ​the ​default, ‌so ‌it ​is ​not ​in ‌the ‌table ​above.

The ‌barrier-frequency ‌change ‌is ‌on ⁠by ⁠default, ​and ‌HK_LAZY_BARRIER=0 ‌restores ‌the ​old ​behaviour. ‌The ‌narrowed ​bit ​pattern ​is ​not ​on ​by ‌default. ‌It ‌is ‌correct ‌for ‌16613 ‌compute ‌cases, ​but ​the ‌bits ‌it ​drops ​were ‌added ‌for ​blits, ​and ​showing ‌it ‌safe ​needs ‌a ‌graphics ‌conformance ‌run ⁠that ⁠has ​not ‌been ‌done. ‌It ​stays ​behind ‌a ‌flag ​until ​then.

What is still open

Three ​questions ​remain ​unanswered.

The ​function ‌of ‌bit ‌7 ‌is ‌unknown. ‌It ‌accounts ‌for ​14 ​of ‌the ‌18 ​microseconds. ​Clearing ‌it ‌crashes ​the ​test ​suite, ‌yet ‌llama.cpp ​keeps ‌decoding ‌at ‌99 ‌tok/s, ⁠so ⁠whatever ​hazard ‌it ‌covers ‌is ​one ​the ‌decode ‌path ​does ​not ​create. ​Identifying ​it ​is ‌the ‌most ‌valuable ‌reverse-engineering ‌task ‌left ‌in ‌this ​driver, ​and ‌it ‌is ​worth ​roughly ‌another ‌1.5x ​on ​this ​workload.

The ‌marginal ‌bandwidth ​is ‌282 ‌GB/s, ‌35% ‌of ⁠the ⁠part's ​peak. ‌Barriers ‌do ‌not ​explain ​it: ‌with ‌every ​barrier ​removed ​the ​effective ​rate ​does ‌not ‌improve, ‌and ‌only ‌the ‌fixed ‌cost ‌disappears. ​The ​output ‌head ‌reaches ​369 ​GB/s ‌on ‌the ​same ​hardware, ​so ‌the ‌layer ​matvecs ‌are ‌below ‌what ‌the ⁠hardware ⁠can ​do.

The ‌gap ‌to ‌Apple's ​own ​driver ‌is ‌about ​2.5x. ​Metal ​on ​the ​same ​machine ‌is ‌reported ‌at ‌around ‌160 ‌tok/s ‌for ‌this ​model, ​which ‌is ‌~380 ​GB/s ​or ‌47% ‌of ​peak. ​The ​source ‌of ‌that ​figure ‌is ‌not ‌given ‌here. ⁠This ⁠work ​moved ‌52.4 ‌to ‌64.8 ​tok/s, ​an ‌improvement ‌of ​23.7%. ​The ​part ​still ​leaves ​most ‌of ‌its ‌bandwidth ‌unused.

One bit was the whole barrier

The ‌sweep ‌above ‌walks ‌cumulative ​prefixes: ​0xffff, ‌0xff, ‌0x7f, ​0x3f. ​Adjacent ‌rows ‌differ ​by ​a ​single ‌bit ‌only ​for ‌bit ‌7 ‌and ‌no ⁠other, ⁠so ​the ‌sweep ‌cannot ‌show ​which ​of ‌bits ‌0–6 ​matter. ​An ​earlier ​version ​of ​this ‌post ‌implied ‌that ‌it ‌could.

Clearing ‌exactly ‌one ‌bit ​at ​a ‌time ‌from ​0xff ​isolates ‌each ‌bit:

Lazy barrier on, so fewer barriers and more hazard exposure. Gated on test-backend-ops' own summary line; llama-bench Qwen3-4B Q4_0, n=32, r=2.
clearstest-backend-opstok/s
nothing15937/1661360.05
bit 015937/1661360.29
bit 115937/1661360.35
bit 215937/1661360.90
bit 3 — usc_cache_inval15937/1661360.09
bit 413462/1661360.34
bit 515825/1661360.04
bit 612125/1661360.46
bit 7crash, no summary111.07

Bits ​0 ​through ​3 ‌are ‌each ​removable ‌with ‌no ‌correctness ‌change, ⁠and ⁠removable ​together. ‌Bits ‌4, ‌5 ​and ​6 ‌are ‌each ​load-bearing ​and ​each ​free: ​every ​arm ‌sits ‌at ‌about ‌60 ‌tok/s ‌whether ‌they ‌are ​set ​or ‌not. ‌They ​fail ​by ‌very ‌different ​amounts. ​Clearing ​bit ‌6 ‌loses ​3812 ‌cases, ‌bit ‌4 ‌loses ⁠2475, ⁠and ​bit ‌5 ‌loses ‌only ​112. ​Three ‌independently ‌required, ​independently ​free ​bits ​are ​consistent ​with ‌three ‌distinct ‌cache ‌domains.

Bit ‌7 ‌is ‌the ‌entire ​cost. ​Clearing ‌it ‌gives ​+85%, ​while ‌the ‌other ​nineteen ​bits ​share ‌3.1% ‌between ​them.

The ‌asymmetry ‌has ‌a ‌plausible ⁠reading, ⁠which ​these ‌measurements ‌do ‌not ​prove. ​A ‌bit ‌that ​is ​required ​but ​costs ​nothing ​behaves ‌like ‌an ‌invalidate, ‌where ‌some ‌tags ‌are ‌dropped ​and ​no ‌data ‌moves. ​A ​bit ‌that ‌is ​required ​and ​costs ‌85% ‌behaves ​like ‌a ‌writeback, ‌where ‌dirty ⁠data ⁠must ​reach ‌the ‌point ‌of ​coherence ​and ‌the ‌barrier ​has ​to ​wait ​for ​it. ​Mesa's ‌own ‌comment ‌names ‌that ‌pair: ‌the ‌PBE ‌cache ​flushed ​and ‌the ‌texture ​cache ​invalidated. ‌The ‌blit ​fix ​set ​both ‌classes, ‌and ​the ‌ablation ‌separates ‌them.

The ‌per-event ⁠cost ⁠follows: ​1/60.05 ‌− ‌1/111.07 ‌is ​7.65 ​ms ‌per ‌token, ​spread ​over ​about ​370 ​barriers, ​or ‌20.7 ‌µs ‌per ‌bit-7 ‌event, ‌against ‌the ‌18.1 ​µs ​attributed ‌earlier ‌to ​"a ​barrier". ‌The ‌cost ​belongs ​to ​bit ‌7 ‌and ​not ‌to ‌the ‌barrier ‌as ⁠such.

The ceiling fails a perplexity check

llama-bench ⁠reports ​tokens ‌per ‌second ‌and ​does ​not ‌check ‌the ​output. ​Every ​rate ​measured ​on ​a ‌crashing ‌mask ‌therefore ‌measures ‌how ‌fast ‌a ‌wrong ​answer ​arrives. ‌Decode ‌with ​bit ​7 ‌cleared ‌does ​not ​crash. ​It ‌runs ‌at ​111 ‌tok/s ‌and ‌looks ‌healthy.

llama-perplexity ⁠does ⁠check ​the ‌output. ‌The ‌test ​used ​the ‌same ‌model, ​corpus ​and ​chunk ​count, ​with ​only ‌the ‌mask ‌changing:

maskkeepsperplexity
0x000fffffstock, bits 0–192.4600 ± 0.12127
0x000000ffbits 0–72.4600 ± 0.12127
0x000000f8bits 3–72.4600 ± 0.12127
0x000000f0bits 4–72.4600 ± 0.12127
0x0000007fno bit 7inf ± inf
0x00000080bit 7 onlyinf ± inf

There ‌is ‌no ‌85% ‌to ‌collect. ​Bit ​7 ‌is ‌required ​for ​the ‌outputs ‌to ​be ​valid ​numbers. ‌The ‌2.08x ​above ‌remains ‌an ‌upper ‌bound ⁠and ⁠was ​labelled ‌results-incorrect ‌from ‌the ​start. ​This ‌measurement ‌confirms ​that ​label.

No ​cheaper ​primitive ​exists. ​The ‌complete ‌list ‌of ‌CDM ‌packet ‌types ‌is ‌Launch, ​Stream ​Link, ‌Stream ‌Terminate, ​Barrier ​and ‌Stream ‌Return, ​and ​the ​machine ‌description ‌contains ​no ‌wait, ‌fence ‌or ‌semaphore. ⁠There ⁠is ​no ‌scoped ‌barrier ‌on ​this ​hardware, ‌and ‌the ​choice ​of ​bits ​is ​the ​only ‌gradation ‌available. ‌The ‌kernel-side ‌barrier ‌is ‌a ‌different ​layer: ​a ‌stamp ‌wait ​between ​whole ‌control ‌streams ​with ​no ​cache-domain ‌fields, ‌so ​it ‌cannot ‌substitute.

The ‌remaining ‌gain ⁠is ⁠small. ​0x000000f0, ‌bits ‌4 ‌through ​7, ​is ‌the ‌narrowest ​mask ​that ​holds. ​It ​passes ​the ‌suite ‌at ‌15937/16613 ‌and ‌returns ‌perplexity ‌bit-identical ‌to ​stock. ​It ‌is ‌worth ​58.51 ​to ‌60.30 ‌tok/s, ​+3.1%. ​It ​is ‌not ‌the ​default, ‌because ‌both ‌gates ‌are ⁠compute-only ⁠and ​the ‌wide ‌mask ‌was ​written ​for ‌blits. ‌It ​needs ​a ​graphics ​gate ​before ​it ‌ships.

Credit

Honeykrisp ‌is ‌Alyssa ‌Rosenzweig's ‌and ‌Asahi ‌Lina's ‌work, ​with ​Valve ‌and ‌Collabora ​behind ​much ‌of ‌it, ​and ​the ​AGX ‌command ‌stream ​in ‌it ‌was ‌reverse ‌engineered ⁠without ⁠documentation. ​The ‌conservative ‌barrier ‌was ​a ​correct ‌decision ‌under ​incomplete ​information, ​and ​the ​source ​comment ‌invites ‌revisiting ‌it. ‌This ‌post ‌supplies ‌measurements ‌for ​that ​revisit. ‌llama.cpp's ‌Vulkan ​alias ​tracking ‌made ‌it ​possible ​to ​count ‌how ‌many ​barriers ‌were ‌actually ‌needed.

Corrected ‌2026-10-10: ⁠the ⁠move ​from ‌52.4 ‌to ‌64.8 ​tok/s ​was ‌stated ‌as ​a ​19.2% ​improvement. ​It ​is ​23.7% ‌(64.8 ‌/ ‌52.4 ‌= ‌1.237). ‌The ‌19.2% ‌figure ​is ​close ‌to ‌the ​same ​12.4 ‌tok/s ‌gap ​taken ​as ​a ‌share ‌of ​64.8, ‌which ‌is ‌19.1%.

boracode.ai · Ronald Adonyo · barrier-after-every-dispatch
content hash 7303fccc6f10
A wide horizon at dusk: layered hills in muted plum and ochre above a lake that holds the last light, a family of crested cranes at the water's edge, an acacia in silhouette and a single bright star above the ridge.