Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(lume): add macOS GPU passthrough (#3070)
Francesco Bonacci3c1acf27748c
diff --git a/blog/assets/gpu-capability-ladder.html b/blog/assets/gpu-capability-ladder.htmlnew file mode 100644index 0000000000..234ff4553f--- /dev/null+++ b/blog/assets/gpu-capability-ladder.html@@ -0,0 +1,313 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <title>The Apple GPU feature cap inside a macOS VM</title>+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link+ href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=Urbanist:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"+ rel="stylesheet"+ />+ <style>+ :root {+ --bg-base: #000000;+ --bg-card: #181818;+ --bg-surface: #212121;+ --ink-strong: #f6f8fb;+ --ink-body: rgba(224, 230, 238, 0.84);+ --ink-muted: rgba(164, 173, 187, 0.82);+ --brand: #9fd7ff;+ --brand-soft: #ecf6ff;+ --brand-tint: rgba(159, 215, 255, 0.09);+ --brand-tint2: rgba(159, 215, 255, 0.06);+ --line-soft: rgba(255, 255, 255, 0.12);+ --line-strong: rgba(255, 255, 255, 0.2);+ --font-display: 'Instrument Serif', Georgia, serif;+ --font-body: 'Urbanist', system-ui, sans-serif;+ --font-docs: 'Inter', system-ui, sans-serif;+ --font-mono: 'JetBrains Mono', 'SF Mono', monospace;+ }+ * {+ box-sizing: border-box;+ }+ html,+ body {+ margin: 0;+ padding: 0;+ background: var(--bg-base);+ font-family: var(--font-docs);+ color: var(--ink-body);+ -webkit-font-smoothing: antialiased;+ }+ .wrap {+ max-width: 1010px;+ margin: 0 auto;+ padding: 40px;+ }+ .panel {+ background: var(--bg-card);+ border: 1px solid var(--line-soft);+ border-radius: 10px;+ padding: 34px 38px 32px;+ }++ .eyebrow {+ font-family: var(--font-mono);+ font-weight: 600;+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 3px;+ color: var(--brand);+ margin-bottom: 12px;+ }+ h1 {+ font-family: var(--font-display);+ font-weight: 400;+ font-size: 32px;+ line-height: 1.1;+ margin: 0 0 10px;+ color: var(--ink-strong);+ letter-spacing: 0.01em;+ }+ h1 .muted {+ color: var(--ink-muted);+ font-style: italic;+ }+ .sub {+ font-size: 14px;+ color: var(--ink-muted);+ margin: 0 0 28px;+ max-width: 640px;+ line-height: 1.7;+ }++ .fig {+ display: flex;+ gap: 22px;+ align-items: stretch;+ }+ .rungs {+ flex: 1 1 auto;+ }+ .rung {+ display: flex;+ align-items: center;+ height: 44px;+ padding: 0 15px;+ border-radius: 8px;+ }+ .rung + .rung {+ margin-top: 3px;+ }+ .fam {+ width: 70px;+ font-family: var(--font-body);+ font-size: 14px;+ font-weight: 600;+ color: var(--ink-strong);+ flex-shrink: 0;+ }+ .era {+ font-family: var(--font-mono);+ font-size: 11px;+ color: var(--ink-muted);+ letter-spacing: 0.2px;+ white-space: nowrap;+ }+ .tag {+ margin-left: auto;+ font-family: var(--font-mono);+ font-size: 10px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0.8px;+ padding: 4px 11px;+ border-radius: 999px;+ white-space: nowrap;+ }++ .rung.host {+ background: var(--brand-tint);+ border: 1px solid rgba(159, 215, 255, 0.3);+ }+ .rung.host .era {+ color: var(--brand-soft);+ }+ .rung.host .tag {+ background: var(--brand);+ color: var(--bg-base);+ }+ .rung.gap {+ background: var(--brand-tint2);+ }+ .rung.capped {+ background: rgba(255, 255, 255, 0.045);+ border: 1px solid var(--line-soft);+ }+ .rung.capped .fam {+ color: var(--ink-body);+ }+ .rung.capped .tag {+ border: 1px solid var(--line-strong);+ color: var(--ink-muted);+ }++ .bracket {+ flex: 0 0 214px;+ display: flex;+ align-items: stretch;+ gap: 13px;+ margin-top: 47px;+ margin-bottom: 47px;+ }+ .bracket-rail {+ width: 9px;+ border: 1.5px solid var(--brand);+ border-left: none;+ border-radius: 0 7px 7px 0;+ opacity: 0.7;+ }+ .bracket-body {+ display: flex;+ flex-direction: column;+ justify-content: center;+ }+ .bracket-title {+ font-family: var(--font-mono);+ font-size: 10.5px;+ font-weight: 600;+ color: var(--brand);+ text-transform: uppercase;+ letter-spacing: 2px;+ margin-bottom: 10px;+ }+ .bracket-body ul {+ margin: 0;+ padding: 0;+ list-style: none;+ }+ .bracket-body li {+ font-family: var(--font-docs);+ font-size: 12.5px;+ color: var(--ink-body);+ padding: 3px 0 3px 16px;+ position: relative;+ line-height: 1.35;+ }+ .bracket-body li::before {+ content: '';+ position: absolute;+ left: 0;+ top: 8px;+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--brand);+ }++ .legend {+ margin-top: 26px;+ display: flex;+ gap: 24px;+ font-family: var(--font-mono);+ font-size: 10.5px;+ text-transform: uppercase;+ letter-spacing: 1px;+ color: var(--ink-muted);+ }+ .legend-item {+ display: flex;+ align-items: center;+ gap: 8px;+ }+ .chip {+ width: 12px;+ height: 12px;+ border-radius: 3px;+ }+ .chip.dim {+ background: transparent;+ border: 1px solid var(--line-strong);+ }+ .caption {+ margin-top: 20px;+ font-size: 12px;+ color: var(--ink-muted);+ max-width: 700px;+ line-height: 1.6;+ border-top: 1px solid var(--line-soft);+ padding-top: 16px;+ }+ </style>+ </head>+ <body>+ <div class="wrap">+ <div class="panel">+ <div class="eyebrow">GPU Feature Cap</div>+ <h1>What a stock macOS VM <span class="muted">reports</span></h1>+ <p class="sub">+ The paravirtualized device runs work on the host GPU but can report a conservative feature+ level. In our tested workload, selected newer paths stayed behind that reporting boundary.+ </p>++ <div class="fig">+ <div class="rungs">+ <div class="rung host">+ <span class="fam">Apple 9</span>+ <span class="era">SIMD-matrix · bfloat16 · 64 KB</span>+ <span class="tag">Tested profile</span>+ </div>+ <div class="rung gap">+ <span class="fam">Apple 8</span><span class="era">Metal 3 / 4</span>+ </div>+ <div class="rung gap">+ <span class="fam">Apple 7</span+ ><span class="era">Metal 3 / 4 · SIMD-group matrix</span>+ </div>+ <div class="rung gap">+ <span class="fam">Apple 6</span><span class="era">Metal 3</span>+ </div>+ <div class="rung capped">+ <span class="fam">Apple 5</span>+ <span class="era">Metal 2 · no matrix path</span>+ <span class="tag">Stock VM reports here</span>+ </div>+ <div class="rung"><span class="fam">Apple 4</span><span class="era">Metal 2</span></div>+ <div class="rung"><span class="fam">Apple 3</span><span class="era">Metal 2</span></div>+ <div class="rung"><span class="fam">Apple 2</span><span class="era">Metal 1</span></div>+ <div class="rung"><span class="fam">Apple 1</span><span class="era">Metal 1</span></div>+ </div>++ <div class="bracket">+ <div class="bracket-rail"></div>+ <div class="bracket-body">+ <div class="bracket-title">Paths behind the cap</div>+ <ul>+ <li>Metal 3 / Metal 4</li>+ <li>SIMD-group matrix multiply</li>+ <li>bfloat16</li>+ <li>64 KB threadgroup memory<br />(up from 32 KB)</li>+ </ul>+ </div>+ </div>+ </div>++ <div class="legend">+ <div class="legend-item">+ <span class="chip" style="background: var(--brand)"></span>Tested capability profile+ </div>+ <div class="legend-item"><span class="chip dim"></span>Stock guest report</div>+ </div>++ <p class="caption">+ Feature levels are illustrative. Apple groups GPU capability into numbered families with+ Metal feature sets layered on top. This graphic ends at Apple 9, the ceiling used in our+ test. The stock guest reported roughly Apple 5 with SIMD-group matrix support unavailable.+ The configured profile changed selected answers so llama.cpp could choose newer paths.+ Each additional feature requires its own virtualization test.+ </p>+ </div>+ </div>+ </body>+</html>diff --git a/blog/assets/metal-kernel-path-mobile.html b/blog/assets/metal-kernel-path-mobile.htmlnew file mode 100644index 0000000000..d04c9672f2--- /dev/null+++ b/blog/assets/metal-kernel-path-mobile.html@@ -0,0 +1,274 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <title>From conservative capability answers to faster Metal kernels</title>+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link+ href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=Urbanist:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"+ rel="stylesheet"+ />+ <style>+ :root {+ --bg-base: #000;+ --bg-card: #181818;+ --ink-strong: #f6f8fb;+ --ink-body: rgba(224, 230, 238, 0.84);+ --ink-muted: rgba(164, 173, 187, 0.82);+ --brand: #9fd7ff;+ --brand-soft: #ecf6ff;+ --brand-tint: rgba(159, 215, 255, 0.09);+ --line-soft: rgba(255, 255, 255, 0.12);+ --font-display: 'Instrument Serif', Georgia, serif;+ --font-body: 'Urbanist', system-ui, sans-serif;+ --font-docs: 'Inter', system-ui, sans-serif;+ --font-mono: 'JetBrains Mono', 'SF Mono', monospace;+ }+ * {+ box-sizing: border-box;+ }+ html,+ body {+ margin: 0;+ padding: 0;+ background: var(--bg-base);+ color: var(--ink-body);+ font-family: var(--font-docs);+ -webkit-font-smoothing: antialiased;+ }+ .wrap {+ width: 430px;+ margin: 0 auto;+ padding: 16px;+ }+ .panel {+ padding: 26px 22px 24px;+ border: 1px solid var(--line-soft);+ border-radius: 10px;+ background: var(--bg-card);+ }+ .eyebrow {+ margin-bottom: 10px;+ color: var(--brand);+ font: 600 9px/1 var(--font-mono);+ letter-spacing: 2.4px;+ text-transform: uppercase;+ }+ h1 {+ margin: 0 0 10px;+ color: var(--ink-strong);+ font: 400 29px/1.08 var(--font-display);+ }+ h1 em {+ color: var(--ink-muted);+ font-weight: 400;+ }+ .sub {+ margin: 0 0 22px;+ color: var(--ink-muted);+ font-size: 13px;+ line-height: 1.55;+ }+ .path {+ display: grid;+ justify-items: stretch;+ }+ .stage,+ .query {+ min-height: 72px;+ padding: 13px 14px;+ border: 1px solid var(--line-soft);+ border-radius: 8px;+ background: rgba(255, 255, 255, 0.025);+ }+ .stage-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 10px;+ }+ .stage-title,+ .query-title {+ color: var(--ink-strong);+ font: 600 16px/1.15 var(--font-body);+ }+ .stage-detail,+ .query-detail {+ margin-top: 7px;+ color: var(--ink-muted);+ font-size: 11px;+ line-height: 1.45;+ }+ .state {+ flex: none;+ padding: 4px 7px;+ border: 1px solid rgba(159, 215, 255, 0.3);+ border-radius: 999px;+ color: var(--brand);+ font: 600 8px/1 var(--font-mono);+ letter-spacing: 1px;+ text-transform: uppercase;+ }+ .connector {+ justify-self: center;+ width: 1px;+ height: 24px;+ position: relative;+ background: linear-gradient(to bottom, var(--brand), rgba(159, 215, 255, 0.18));+ opacity: 0.75;+ }+ .connector::after {+ content: '';+ position: absolute;+ left: -3px;+ bottom: -1px;+ width: 7px;+ height: 7px;+ border-right: 1.5px solid var(--brand);+ border-bottom: 1.5px solid var(--brand);+ transform: rotate(45deg);+ }+ .query {+ border-color: rgba(159, 215, 255, 0.34);+ background: var(--brand-tint);+ }+ .query .stage-head {+ min-height: 20px;+ }+ .query-title {+ color: var(--brand-soft);+ }+ .query .state {+ border-color: var(--brand);+ background: var(--brand);+ color: var(--bg-base);+ }+ .branch-connector {+ justify-self: center;+ width: 1px;+ height: 24px;+ background: rgba(159, 215, 255, 0.58);+ }+ .branch {+ min-height: 144px;+ padding: 16px;+ border: 1px solid var(--line-soft);+ border-radius: 8px;+ background: rgba(255, 255, 255, 0.025);+ }+ .branch.unlocked {+ border-color: rgba(159, 215, 255, 0.34);+ background: var(--brand-tint);+ }+ .branch-label {+ color: var(--ink-muted);+ font: 600 9px/1 var(--font-mono);+ letter-spacing: 1.5px;+ text-transform: uppercase;+ }+ .branch.unlocked .branch-label {+ color: var(--brand);+ }+ .answer {+ margin-top: 11px;+ color: var(--ink-strong);+ font: 600 21px/1.15 var(--font-body);+ }+ .features {+ margin-top: 7px;+ color: var(--ink-muted);+ font: 400 10.5px/1.5 var(--font-mono);+ }+ .result {+ margin-top: 12px;+ padding-top: 11px;+ border-top: 1px solid var(--line-soft);+ color: var(--ink-body);+ font: 500 15px/1.2 var(--font-body);+ }+ .branch.unlocked .result {+ color: var(--brand-soft);+ }+ .arrow {+ margin-right: 6px;+ color: var(--brand);+ }+ .caption {+ margin: 20px 0 0;+ padding-top: 15px;+ border-top: 1px solid var(--line-soft);+ color: var(--ink-muted);+ font-size: 11px;+ line-height: 1.55;+ }+ </style>+ </head>+ <body>+ <div class="wrap">+ <div class="panel">+ <div class="eyebrow">Metal Execution Path</div>+ <h1>From conservative capability answers to <em>faster Metal kernels</em></h1>+ <p class="sub">+ The host GPU and Apple’s virtualization bridge stay the same. The decision changes when+ one guest process asks which Metal paths it can use.+ </p>++ <div class="path">+ <div class="stage">+ <div class="stage-head">+ <div class="stage-title">Host Apple GPU</div>+ <div class="state">Unchanged</div>+ </div>+ <div class="stage-detail">Executes the workload on Apple Silicon</div>+ </div>+ <div class="connector"></div>+ <div class="stage">+ <div class="stage-head">+ <div class="stage-title">Virtualization.framework</div>+ <div class="state">Unchanged</div>+ </div>+ <div class="stage-detail">Apple’s paravirtualized graphics bridge</div>+ </div>+ <div class="connector"></div>+ <div class="stage">+ <div class="stage-head">+ <div class="stage-title">Guest virtual GPU</div>+ <div class="state">Unchanged</div>+ </div>+ <div class="stage-detail">The same virtual Metal device in both runs</div>+ </div>+ <div class="connector"></div>+ <div class="query">+ <div class="stage-head">+ <div class="query-title">Capability query</div>+ <div class="state">One process</div>+ </div>+ <div class="query-detail">What can this workload safely select?</div>+ </div>+ <div class="branch-connector"></div>+ <div class="branch">+ <div class="branch-label">Stock guest answer</div>+ <div class="answer">Apple 5 · 32 KB</div>+ <div class="features">+ SIMD-group matrix unavailable<br />Conservative feature selection+ </div>+ <div class="result"><span class="arrow">→</span>slower llama.cpp kernel</div>+ </div>+ <div class="branch-connector"></div>+ <div class="branch unlocked">+ <div class="branch-label">Shim · tested profile</div>+ <div class="answer">Apple 9 · 64 KB</div>+ <div class="features">SIMD-group matrix · bfloat16<br />Newer tested Metal paths</div>+ <div class="result"><span class="arrow">→</span>faster llama.cpp kernel</div>+ </div>+ </div>++ <p class="caption">+ Selected capability answers change for one guest process while Apple’s bridge and virtual+ device stay in place. Each additional Metal API requires its own virtualization test.+ </p>+ </div>+ </div>+ </body>+</html>diff --git a/blog/assets/metal-kernel-path.html b/blog/assets/metal-kernel-path.htmlnew file mode 100644index 0000000000..56e8bc0e9d--- /dev/null+++ b/blog/assets/metal-kernel-path.html@@ -0,0 +1,340 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <title>From conservative capability answers to faster Metal kernels</title>+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link+ href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=Urbanist:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"+ rel="stylesheet"+ />+ <style>+ :root {+ --bg-base: #000000;+ --bg-card: #181818;+ --bg-surface: #212121;+ --ink-strong: #f6f8fb;+ --ink-body: rgba(224, 230, 238, 0.84);+ --ink-muted: rgba(164, 173, 187, 0.82);+ --brand: #9fd7ff;+ --brand-soft: #ecf6ff;+ --brand-tint: rgba(159, 215, 255, 0.09);+ --brand-tint2: rgba(159, 215, 255, 0.06);+ --line-soft: rgba(255, 255, 255, 0.12);+ --line-strong: rgba(255, 255, 255, 0.2);+ --font-display: 'Instrument Serif', Georgia, serif;+ --font-body: 'Urbanist', system-ui, sans-serif;+ --font-docs: 'Inter', system-ui, sans-serif;+ --font-mono: 'JetBrains Mono', 'SF Mono', monospace;+ }+ * {+ box-sizing: border-box;+ }+ html,+ body {+ margin: 0;+ padding: 0;+ background: var(--bg-base);+ font-family: var(--font-docs);+ color: var(--ink-body);+ -webkit-font-smoothing: antialiased;+ }+ .wrap {+ width: 930px;+ margin: 0 auto;+ padding: 40px;+ }+ .panel {+ background: var(--bg-card);+ border: 1px solid var(--line-soft);+ border-radius: 10px;+ padding: 34px 38px 32px;+ }++ .eyebrow {+ font-family: var(--font-mono);+ font-weight: 600;+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 3px;+ color: var(--brand);+ margin-bottom: 12px;+ }+ h1 {+ font-family: var(--font-display);+ font-weight: 400;+ font-size: 32px;+ line-height: 1.1;+ margin: 0 0 10px;+ color: var(--ink-strong);+ letter-spacing: 0.01em;+ }+ h1 .muted {+ color: var(--ink-muted);+ font-style: italic;+ }+ .sub {+ font-size: 14px;+ color: var(--ink-muted);+ margin: 0 0 26px;+ max-width: 720px;+ line-height: 1.7;+ }++ .path {+ display: grid;+ justify-items: center;+ }+ .stage {+ width: 510px;+ min-height: 58px;+ display: grid;+ grid-template-columns: 1fr auto;+ align-items: center;+ gap: 20px;+ padding: 12px 16px;+ border: 1px solid var(--line-soft);+ border-radius: 8px;+ background: rgba(255, 255, 255, 0.025);+ }+ .stage-title {+ font-family: var(--font-body);+ font-size: 16px;+ font-weight: 600;+ color: var(--ink-strong);+ }+ .stage-detail {+ margin-top: 3px;+ font-family: var(--font-mono);+ font-size: 10.5px;+ letter-spacing: 0.3px;+ color: var(--ink-muted);+ }+ .state {+ font-family: var(--font-mono);+ font-size: 9.5px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 1.2px;+ color: var(--brand);+ border: 1px solid rgba(159, 215, 255, 0.3);+ border-radius: 999px;+ padding: 5px 9px;+ }+ .connector {+ height: 34px;+ width: 1px;+ background: linear-gradient(to bottom, var(--brand), rgba(159, 215, 255, 0.18));+ position: relative;+ opacity: 0.75;+ }+ .connector::after {+ content: '';+ position: absolute;+ left: -3px;+ bottom: -1px;+ width: 7px;+ height: 7px;+ border-right: 1.5px solid var(--brand);+ border-bottom: 1.5px solid var(--brand);+ transform: rotate(45deg);+ }++ .query {+ width: 570px;+ min-height: 70px;+ padding: 14px 17px;+ border-radius: 8px;+ border: 1px solid rgba(159, 215, 255, 0.34);+ background: var(--brand-tint);+ display: grid;+ grid-template-columns: 1fr auto;+ align-items: center;+ gap: 20px;+ }+ .query-title {+ font-family: var(--font-body);+ font-size: 17px;+ font-weight: 600;+ color: var(--brand-soft);+ }+ .query-detail {+ margin-top: 4px;+ font-size: 12px;+ color: var(--ink-muted);+ }+ .query .state {+ background: var(--brand);+ color: var(--bg-base);+ border-color: var(--brand);+ }++ .fork {+ width: 620px;+ height: 44px;+ position: relative;+ }+ .fork::before {+ content: '';+ position: absolute;+ top: 0;+ left: 50%;+ height: 20px;+ width: 1px;+ background: rgba(159, 215, 255, 0.65);+ }+ .fork::after {+ content: '';+ position: absolute;+ left: 25%;+ right: 25%;+ top: 20px;+ height: 24px;+ border-top: 1px solid rgba(159, 215, 255, 0.52);+ border-left: 1px solid rgba(159, 215, 255, 0.52);+ border-right: 1px solid rgba(159, 215, 255, 0.52);+ border-radius: 7px 7px 0 0;+ }++ .branches {+ width: 100%;+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 16px;+ }+ .branch {+ min-height: 154px;+ border-radius: 8px;+ padding: 17px 18px 16px;+ border: 1px solid var(--line-soft);+ background: rgba(255, 255, 255, 0.025);+ }+ .branch.unlocked {+ background: var(--brand-tint);+ border-color: rgba(159, 215, 255, 0.34);+ }+ .branch-label {+ font-family: var(--font-mono);+ font-size: 10px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 1.7px;+ color: var(--ink-muted);+ }+ .branch.unlocked .branch-label {+ color: var(--brand);+ }+ .answer {+ margin-top: 12px;+ font-family: var(--font-body);+ font-size: 21px;+ font-weight: 600;+ color: var(--ink-strong);+ }+ .features {+ margin-top: 7px;+ font-family: var(--font-mono);+ font-size: 10.5px;+ line-height: 1.55;+ color: var(--ink-muted);+ }+ .result {+ margin-top: 14px;+ padding-top: 12px;+ border-top: 1px solid var(--line-soft);+ font-family: var(--font-body);+ font-size: 15px;+ color: var(--ink-body);+ }+ .branch.unlocked .result {+ color: var(--brand-soft);+ }+ .result-arrow {+ color: var(--brand);+ margin-right: 7px;+ }++ .caption {+ margin-top: 22px;+ font-size: 12px;+ color: var(--ink-muted);+ max-width: 740px;+ line-height: 1.6;+ border-top: 1px solid var(--line-soft);+ padding-top: 16px;+ }+ </style>+ </head>+ <body>+ <div class="wrap">+ <div class="panel">+ <div class="eyebrow">Metal Execution Path</div>+ <h1>+ From conservative capability answers to <span class="muted">faster Metal kernels</span>+ </h1>+ <p class="sub">+ The host GPU and Apple’s virtualization bridge stay the same. The decision changes when+ one guest process asks which Metal paths it can use.+ </p>++ <div class="path">+ <div class="stage">+ <div>+ <div class="stage-title">Host Apple GPU</div>+ <div class="stage-detail">Executes the workload on Apple Silicon</div>+ </div>+ <div class="state">Unchanged</div>+ </div>+ <div class="connector"></div>+ <div class="stage">+ <div>+ <div class="stage-title">Virtualization.framework bridge</div>+ <div class="stage-detail">Apple’s existing paravirtualized graphics path</div>+ </div>+ <div class="state">Unchanged</div>+ </div>+ <div class="connector"></div>+ <div class="stage">+ <div>+ <div class="stage-title">Guest paravirtualized GPU</div>+ <div class="stage-detail">The same virtual Metal device in both runs</div>+ </div>+ <div class="state">Unchanged</div>+ </div>+ <div class="connector"></div>+ <div class="query">+ <div>+ <div class="query-title">Capability query</div>+ <div class="query-detail">What can this workload safely select?</div>+ </div>+ <div class="state">One process</div>+ </div>+ <div class="fork"></div>++ <div class="branches">+ <div class="branch">+ <div class="branch-label">Stock guest answer</div>+ <div class="answer">Apple 5 · 32 KB</div>+ <div class="features">+ SIMD-group matrix unavailable<br />Conservative feature selection+ </div>+ <div class="result"><span class="result-arrow">→</span>slower llama.cpp kernel</div>+ </div>+ <div class="branch unlocked">+ <div class="branch-label">Shim · tested profile</div>+ <div class="answer">Apple 9 · 64 KB</div>+ <div class="features">SIMD-group matrix · bfloat16<br />Newer tested Metal paths</div>+ <div class="result"><span class="result-arrow">→</span>faster llama.cpp kernel</div>+ </div>+ </div>+ </div>++ <p class="caption">+ Selected capability answers change for one guest process while Apple’s bridge and virtual+ device stay in place. Each additional Metal API requires its own virtualization test.+ </p>+ </div>+ </div>+ </body>+</html>diff --git a/blog/gpu-passthrough-macos-vms.md b/blog/gpu-passthrough-macos-vms.mdnew file mode 100644index 0000000000..c45cf3437e--- /dev/null+++ b/blog/gpu-passthrough-macos-vms.md@@ -0,0 +1,159 @@+# Apple Silicon and macOS VMs: 11–16× Faster LLM Inference with llama.cpp++_Published on August 11, 2026 by Francesco Bonacci and Johnny Franks_++If you've been following Cua from the start, you may remember that it began with a [Show HN](https://news.ycombinator.com/item?id=42908061) launch for Lume, our macOS virtualization stack.++Today, we're sharing the first result from a broader effort to connect that `Virtualization.framework` foundation to the local computer-use environments behind Cua Driver and the infrastructure behind [Cua Cloud and Fleets](https://cua.ai/signup?redirect_url=%2Fwaitlist): a small, process-scoped compatibility layer that unlocks newer Metal fast paths inside a macOS guest.++We're releasing this work today as a research release under the same permissive license as Lume and Cua, so others can reproduce the results and help map which Apple Silicon chips, macOS releases, and Metal workloads benefit.++++Apple Vz users have been running into these limitations elsewhere too. Tart, another notable CLI built on Apple's `Virtualization.framework`, has an open [“No GPU passthrough in macOS guest?”](https://github.com/openai/tart/issues/1032) issue asking whether the framework can provide usable graphics and decent LLM performance in a macOS VM guest. The VM continues to use the virtual GPU that Apple provides. Our work exposes newer Metal paths on that device and closes part of the practical gap.++On an M1 Ultra, TinyLlama 1.1B running through llama.cpp processed prompts **11.08× faster** and generated tokens **16.36× faster** than the same workload in the same stock VM. Prompt processing reached 98% of our bare-metal result. The source, build scripts, capability probe, and raw benchmark logs are included so you can inspect and reproduce the result.++We repeated the experiment with Google's [Gemma 4 12B QAT Q4_0](https://huggingface.co/google/gemma-4-12B-it-qat-q4_0-gguf), a 6.98 GB model released this year. The same layer improved prompt processing **7.20×** and token generation **14.54×**. The unlocked VM reached 99.59% of bare-metal prompt speed and 94.82% of bare-metal generation speed.++## The cap inside a macOS VM++Apple's `Virtualization.framework` presents a macOS guest with a [virtual graphics device](https://developer.apple.com/documentation/virtualization/vzmacgraphicsdeviceconfiguration). The guest submits Metal work through a purpose-built GPU driver, and Apple's host stack executes it on the physical GPU. This arrangement is paravirtualization, where the host keeps control of the hardware and the guest uses a virtualization-aware device.++This differs from other virtualization stacks built on QEMU and KVM, which can use a different architecture. On x86 Linux hosts, [VFIO](https://www.kernel.org/doc/html/latest/driver-api/vfio.html) can assign a compatible physical PCI device or hardware function to a VM through an IOMMU, giving the guest direct access to that device. This is the model usually meant by GPU passthrough.++In our stock Tahoe VM, the paravirtualized device reported roughly an Apple 5-era family, 32 KB of maximum threadgroup memory, and SIMD-group matrix support as unavailable. Modern Metal software uses those answers to select kernels, so llama.cpp took a slower path even though the device could execute newer kernels.++Apple documents GPU capability through [GPU families and feature tables](https://developer.apple.com/metal/capabilities/) and recommends [querying the device at runtime](https://developer.apple.com/documentation/metal/detecting-gpu-features-and-metal-software-versions). That makes the reported capability boundary consequential: applications are doing exactly what the platform tells them to do.++++## The solution: a process-scoped Metal capability shim++We built a small Metal capability shim (a compatibility layer inserted between an application and an API) that runs inside one guest process. It intercepts selected Metal capability queries and changes the answers returned to that process. Metal applications use those answers to select kernels, so returning the tested Apple-family and threadgroup-memory values lets llama.cpp choose its newer GPU paths. For our tested profile, the shim:++- answers `supportsFamily:` through Apple family 9 (`1009`); and+- raises the reported maximum threadgroup memory from 32 KB to 64 KB.++That was enough for the tested llama.cpp build to select newer SIMD-group reduction, SIMD-group matrix, and bfloat16 paths:++| Capability | Stock guest | Tested profile |+| -------------------------- | ----------: | -------------: |+| `supportsFamily:1009` | false | **true** |+| SIMD-group matrix | off | **on** |+| SIMD-group reduction | off | **on** |+| bfloat16 | off | **on** |+| Maximum threadgroup memory | 32 KB | **64 KB** |++The tested profile changes two reported values: Apple-family answers and the threadgroup-memory limit. Common, Mac, Metal, and working-set-size values keep their stock settings during the benchmark. We removed the original research hook's private feature-profile hook, clock and timing interposition, mesh substitution, ray-tracing override, argument-layout guard, and pipeline-compilation fallback. Its source is small enough to audit, and malformed or missing configuration keeps the process on its stock capability path.++<picture>+ <source media="(max-width: 600px)" srcset="https://github.com/user-attachments/assets/6c7e1a9e-bb01-4eba-887b-ff362bac340b">+ <img src="https://github.com/user-attachments/assets/34f15072-f18b-4747-9a98-6397601cbffc" alt="From conservative capability answers to faster Metal kernels: the host Apple GPU, Virtualization.framework bridge, and guest paravirtualized GPU stay unchanged while a process-scoped capability query selects either the stock Apple 5 and 32 KB path or the tested Apple 9 and 64 KB path.">+</picture>++The workload stays on Apple's `Virtualization.framework` graphics path and executes on the host's Apple GPU. The capability changes are scoped to the injected guest process.++Physical GPU assignment, raw PCI or VFIO passthrough, and kernel changes sit outside this mechanism. A reported family describes the paths covered by our tests; each additional Metal API requires separate validation.++The shim unlocks Metal capabilities on Apple's existing virtual GPU path. VM users often encounter the broader limitation under the name “GPU passthrough.”++## Fresh result from the minimal artifact++We tested on one Apple M1 Ultra with a 48-core GPU and macOS 26.6.1. The guest was the current public Tahoe Cua image (macOS 26.5.2, 8 vCPU, and 16 GiB) running in Lume 0.5.1. All three runs used the official llama.cpp `b10167` release and the same TinyLlama 1.1B Chat Q4_K_M model.++The command was:++```bash+llama-bench -m tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf \+ -p 512 -n 128 -r 10 -t 8 -ngl -1 -o json+```++Values below are medians of the ten samples emitted for each benchmark row:++| Workload | Bare-metal host | Stock guest | **Unlocked guest** | Guest speedup | Unlocked / host |+| ----------------------------- | --------------: | -----------: | -----------------: | ------------: | --------------: |+| Prompt processing, 512 tokens | 4,871.99 tok/s | 431.86 tok/s | **4,786.70 tok/s** | **11.08×** | **98.25%** |+| Token generation, 128 tokens | 286.71 tok/s | 12.63 tok/s | **206.60 tok/s** | **16.36×** | **72.06%** |++Prompt processing nearly reached the host result. Generation reached 72.06% of host speed, leaving a measurable VM gap. The gain depends on the host GPU, guest version, application, and workload shape.++The [TinyLlama raw results and environment record](https://github.com/trycua/cua/tree/main/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra) include the exact image digest, model and binary hashes, commands, JSON output, stderr, and checksums. These release-candidate results certify the reduced shim used in this post.++### A current 12B model++TinyLlama makes a useful controlled benchmark because it runs quickly and exposes the Metal path clearly. We also wanted a larger model that developers might choose today, so we ran Google's official Gemma 4 12B instruction-tuned QAT Q4_0 GGUF through the same llama.cpp binary.++The host, VM, shim, benchmark shape, and ten-sample method stayed the same. We disabled speculative decoding and left the multimodal projector unloaded, keeping the comparison on the same Metal inference path:++| Workload | Bare-metal host | Stock guest | **Unlocked guest** | Guest speedup | Unlocked / host |+| ----------------------------- | --------------: | ----------: | -----------------: | ------------: | --------------: |+| Prompt processing, 512 tokens | 517.88 tok/s | 71.66 tok/s | **515.76 tok/s** | **7.20×** | **99.59%** |+| Token generation, 128 tokens | 52.38 tok/s | 3.41 tok/s | **49.67 tok/s** | **14.54×** | **94.82%** |++The [Gemma 4 evidence](https://github.com/trycua/cua/tree/main/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4) pins Google's model revision and SHA-256 alongside the final raw samples. We discarded and reran a preliminary stock series after detecting another host compute workload. The retained stock, unlocked, and bare-metal files come from the same uncontended window and show tight sample ranges.++We also tested [MLX-LM](https://github.com/ml-explore/mlx-lm) 0.31.3 with `mlx-community/Llama-3.2-3B-Instruct-4bit` on MLX 0.32.0. Performance stayed flat because MLX-LM was already fast in the stock VM:++| Workload | Stock guest | Unlocked guest | Ratio |+| ----------------------------- | -------------: | -------------: | -----: |+| Prompt processing, 512 tokens | 1,656.55 tok/s | 1,665.47 tok/s | 1.005× |+| Token generation, 128 tokens | 172.09 tok/s | 170.86 tok/s | 0.993× |++That flat result helped define the release profile. During ablation, advertising `MTLGPUFamilyMetal3` made MLX request a residency set unavailable through the paravirtualized device. The release shim limits changed answers to Apple-family enums and keeps Metal 3 at its stock value. The relevant MLX branch is visible in its [Metal residency implementation](https://github.com/ml-explore/mlx/blob/v0.32.0/mlx/backend/metal/resident.cpp).++## Where this sits with Apple's platform++This runs entirely on Apple hardware through the paravirtualized GPU path that Apple ships with `Virtualization.framework`. The shim affects selected values read by one guest process. The host, guest kernel, other guest processes, content-protection state, and licensing state keep their existing configuration.++The technique relies on private, version-sensitive behavior in the guest's Metal implementation. Apple may change it between macOS releases, so we test each host and guest combination independently. Unsupported methods keep the process on its stock path, and each additional API needs its own virtualization test.++We would welcome clarification from Apple on the intended behavior and supportability of the unrestricted feature level for paravirtualized graphics. Apple engineers working on Metal or `Virtualization.framework` can reach us at [[email protected]](mailto:[email protected]).++## Try it in a Lume VM++The source lives in [`libs/lume/metal-capability-shim`](https://github.com/trycua/cua/tree/main/libs/lume/metal-capability-shim). Build and verify both architecture-specific dylibs:++```bash+cd libs/lume/metal-capability-shim+./Scripts/build.sh+./Scripts/verify.sh+```++Stop the VM, enable the unrestricted feature level for VMs launched by your macOS user, and restart it:++```bash+lume stop my-vm+defaults write com.apple.gpusw.ParavirtualizedGraphics \+ ForceUnrestrictedDeviceFeatureLevel -bool true+lume run my-vm+```++Copy the matching dylib and the probe or workload into the guest, then scope activation to that process:++```bash+lume ssh my-vm \+ "DYLD_INSERT_LIBRARIES=/path/to/LumeMetalCapabilities-arm64.dylib \+ LUME_METAL_APPLE_FAMILY_MAX=1009 \+ /path/to/metal-capabilities 1009"+```++For a long-running inference server, renderer, or worker, use a per-workload LaunchAgent. Set `DYLD_INSERT_LIBRARIES` in that workload's environment so the login session remains stock. The [Lume guide](https://cua.ai/docs/how-to-guides/lume/gpu-passthrough) has a complete template, checksum and verification steps, and rollback instructions.++Removing the environment variables and restarting the workload returns it to stock behavior. To restore the host preference, stop the VM, delete `ForceUnrestrictedDeviceFeatureLevel`, and start the VM again.++## Limitations++- **Experimental and version-sensitive.** The shim uses private guest Metal implementation details that can change in any macOS release.+- **Per-process.** It affects only the injected workload and its children; hardened or platform-protected executables may reject library injection.+- **Configured capability profile.** It reports the Apple-family values covered by our tests. Physical-GPU capability discovery remains outside its scope.+- **Narrow validation.** The current evidence covers the capability probe, two llama.cpp workloads, and one MLX-LM compatibility run on the listed M1 Ultra host and Tahoe guest. Additional chips, guest releases, models, and Metal APIs need separate tests.+- **Still a VM.** Existing `Virtualization.framework` rendering and virtualization limits remain.++## Wrapping up++The guest's conservative answers hid a surprisingly capable GPU path. On our test machine, two narrowly scoped capability changes moved TinyLlama prompt processing from 432 to 4,787 tokens per second. With Gemma 4 12B, prompt processing moved from 71.66 to 515.76 tokens per second and generation from 3.41 to 49.67 while the workload stayed on Apple's existing GPU bridge.++Lume started as a way to make macOS VMs practical for developers. This result gives us a foundation to test across more Apple Silicon generations, guest releases, and Metal workloads.++Want to help? [Star Cua on GitHub](https://github.com/trycua/cua) and test the shim on your setup. [Open an issue](https://github.com/trycua/cua/issues/new/choose) with your host chip, host and guest versions, exact workload, and both stock and unlocked results. If you validate a new combination or improve the shim, [send a pull request](https://github.com/trycua/cua/pulls).diff --git a/docs/content/docs/how-to-guides/lume/gpu-passthrough.mdx b/docs/content/docs/how-to-guides/lume/gpu-passthrough.mdxnew file mode 100644index 0000000000..923aa609ab--- /dev/null+++ b/docs/content/docs/how-to-guides/lume/gpu-passthrough.mdx@@ -0,0 +1,287 @@+---+title: Metal capability unlock+description: Enable a configured, tested Metal capability profile for one workload inside a Lume macOS VM.+---++Lume VMs use Apple's paravirtualized GPU bridge, but a stock macOS guest can report conservative+Metal capabilities. Applications that query those values may skip newer GPU paths even when the+paravirtualized device can execute the work.++This guide builds a small MIT-licensed shim and activates it for one process. The shim changes+selected capability answers; it does not pass a physical GPU to the guest, patch the host, or change+the guest kernel. If you're looking for computer-use automation instead, start with+[Cua Driver](/tutorials/drive-your-first-app) or+[Cua Sandbox](/tutorials/your-first-local-sandbox).++Read the [technical writeup](/blog/gpu-passthrough-macos-vms) for the mechanism, benchmark evidence,+and architectural context. Apple's [Metal capability tables](https://developer.apple.com/metal/capabilities/)+and [feature-detection guide](https://developer.apple.com/documentation/metal/detecting-gpu-features-and-metal-software-versions)+explain how applications select behavior from reported device support.++## What the shim changes++The tested profile can raise two values returned to the injected process:++- the result of `supportsFamily:` through a configured Apple-family ceiling; and+- the reported maximum threadgroup memory.++The release candidate contains no timing or clock interposition, mesh substitution, ray-tracing+override, private feature-profile hook, argument-layout guard, or pipeline-compilation fallback. It+leaves the Common, Mac, and Metal family ranges unchanged. A missing, out-of-range, or malformed+`LUME_METAL_APPLE_FAMILY_MAX` leaves the process on its stock capability path.++Reported support is not proof that every Metal API associated with a family works through+virtualization. Test each workload and host/guest version independently.++## Requirements++- Apple Silicon host+- A [Lume macOS VM](/how-to-guides/lume/install-lume)+- Xcode Command Line Tools on the machine where you build the shim+- A workload you control; hardened or platform-protected executables may reject injected libraries++Our release-candidate validation used Lume 0.5.1, an Apple M1 Ultra host running macOS 26.6.1, and+the public Tahoe Cua guest image at macOS 26.5.2. Other combinations are experimental until tested.++## Build and verify the shim++Clone the Cua repository on an Apple Silicon Mac, then build the architecture-specific dylibs and+capability probe:++```bash+git clone https://github.com/trycua/cua.git+cd cua/libs/lume/metal-capability-shim+./Scripts/build.sh+./Scripts/verify.sh+```++`verify.sh` checks the architectures, ad-hoc code signatures, absence of research-only timing and+compatibility symbols, and the generated checksums. The output is written to `dist/`:++```text+dist/+├── LumeMetalCapabilities-arm64.dylib+├── LumeMetalCapabilities-arm64e.dylib+├── SHA256SUMS+└── metal-capabilities+```++Most guest workloads are `arm64`. Check the target executable before selecting a dylib:++```bash+lipo -archs /absolute/path/to/your-workload+shasum -a 256 -c dist/SHA256SUMS+```++## Enable the host capability path++The preference below applies to VMs launched by your macOS user. Stop the VM before changing it so+the graphics device is recreated with the requested feature level:++```bash+lume stop my-vm+defaults write com.apple.gpusw.ParavirtualizedGraphics \+ ForceUnrestrictedDeviceFeatureLevel -bool true+defaults read com.apple.gpusw.ParavirtualizedGraphics \+ ForceUnrestrictedDeviceFeatureLevel+lume run my-vm+```++The `defaults read` command should print `1`.++To restore the stock host setting later, stop the VM, delete the preference, and start the VM again:++```bash+lume stop my-vm+defaults delete com.apple.gpusw.ParavirtualizedGraphics \+ ForceUnrestrictedDeviceFeatureLevel+lume run my-vm+```++## Copy and verify the artifact in the guest++Copy the `arm64` dylib and probe into a stable, workload-specific directory. Replace the local path+below with the path to your Cua checkout:++```bash+lume ssh my-vm "mkdir -p '/Users/lume/.local/share/lume/metal-capabilities'"++VM_IP=$(lume get my-vm --format json | jq -r '.[0].ipAddress')+scp ./dist/LumeMetalCapabilities-arm64.dylib ./dist/metal-capabilities \+ "lume@${VM_IP}:/Users/lume/.local/share/lume/metal-capabilities/"+```++For a standard unattended Lume image, `scp` prompts for the default guest password, `lume`. Use the+credentials configured for your image if they differ.++Record the local checksums, then compare them with the guest copies:++```bash+shasum -a 256 dist/LumeMetalCapabilities-arm64.dylib dist/metal-capabilities++lume ssh my-vm \+ "shasum -a 256 \+ '/Users/lume/.local/share/lume/metal-capabilities/LumeMetalCapabilities-arm64.dylib' \+ '/Users/lume/.local/share/lume/metal-capabilities/metal-capabilities'"+```++## Verify stock and unlocked capability reporting++Run the probe without injection first:++```bash+lume ssh my-vm \+ "'/Users/lume/.local/share/lume/metal-capabilities/metal-capabilities' 1009"+```++Then run the same probe with the tested profile:++```bash+lume ssh my-vm \+ "DYLD_INSERT_LIBRARIES='/Users/lume/.local/share/lume/metal-capabilities/LumeMetalCapabilities-arm64.dylib' \+ LUME_METAL_APPLE_FAMILY_MAX=1009 \+ '/Users/lume/.local/share/lume/metal-capabilities/metal-capabilities' 1009"+```++In our Tahoe guest, `supportsFamily:1009` changed from `false` to `true`, and maximum threadgroup+memory changed from 32,768 to 65,536 bytes. Your result may differ on another host or guest. Stop if+the injected process crashes, reports Metal errors, or behaves incorrectly.++The tested command uses these values:++| Variable | Default when active | Behavior |+| ----------------------------------------- | ------------------: | ------------------------------------------------------------------------------------------------- |+| `LUME_METAL_APPLE_FAMILY_MAX` | required | Answer `supportsFamily:` through this Apple-family ceiling. The tested value is Apple 9 (`1009`). |+| `LUME_METAL_MAX_THREADGROUP_MEMORY` | `65536` | Raise maximum threadgroup memory to at least this many bytes. |+| `LUME_METAL_RECOMMENDED_WORKING_SET_SIZE` | unchanged | Raise the reported working-set size only when explicitly set. |++Keep the defaults unless you have isolated evidence for another profile. Do not substitute a Common,+Mac, or Metal-family enum: the shim intentionally accepts only Apple-family values from `1001` to+`1999`.++## Run one workload++Injection is per-process, so only the selected workload and its child processes see the changed+answers:++```bash+lume ssh my-vm \+ "DYLD_INSERT_LIBRARIES='/Users/lume/.local/share/lume/metal-capabilities/LumeMetalCapabilities-arm64.dylib' \+ LUME_METAL_APPLE_FAMILY_MAX=1009 \+ /absolute/path/to/your-workload first-argument"+```++Do not use `launchctl setenv DYLD_INSERT_LIBRARIES ...`; that applies injection across the login+session and can affect unrelated applications.++## Run a workload with launchd++For a long-running inference server, renderer, or worker, create a per-user LaunchAgent inside the+guest. The environment applies only to that program and its child processes.++Save this as+`/Users/lume/Library/LaunchAgents/com.trycua.lume.metal-workload.plist`, replacing the executable and+arguments with absolute paths that exist in the guest:++```xml+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>Label</key>+ <string>com.trycua.lume.metal-workload</string>++ <key>ProgramArguments</key>+ <array>+ <string>/absolute/path/to/your-workload</string>+ <string>first-argument</string>+ </array>++ <key>EnvironmentVariables</key>+ <dict>+ <key>DYLD_INSERT_LIBRARIES</key>+ <string>/Users/lume/.local/share/lume/metal-capabilities/LumeMetalCapabilities-arm64.dylib</string>+ <key>LUME_METAL_APPLE_FAMILY_MAX</key>+ <string>1009</string>+ </dict>++ <key>StandardOutPath</key>+ <string>/Users/lume/Library/Logs/Lume/metal-workload.stdout.log</string>+ <key>StandardErrorPath</key>+ <string>/Users/lume/Library/Logs/Lume/metal-workload.stderr.log</string>+</dict>+</plist>+```++Each `ProgramArguments` entry is one argument. Remove `first-argument` if the program takes no+arguments, or add one `<string>` per argument. Do not combine the executable and arguments into one+string.++Create the required directories, validate the plist, and start the LaunchAgent from a logged-in+guest session:++```bash+mkdir -p "$HOME/Library/LaunchAgents" "$HOME/Library/Logs/Lume"++PLIST="$HOME/Library/LaunchAgents/com.trycua.lume.metal-workload.plist"+SERVICE="gui/$(id -u)/com.trycua.lume.metal-workload"++plutil -lint "$PLIST"+launchctl bootstrap "gui/$(id -u)" "$PLIST"+launchctl kickstart -k "$SERVICE"+launchctl print "$SERVICE"+```++Inspect the service output:++```bash+tail -f "$HOME/Library/Logs/Lume/metal-workload.stdout.log"+tail -f "$HOME/Library/Logs/Lume/metal-workload.stderr.log"+```++If the program fails after injection, unload the service and run the executable directly without the+shim before debugging further:++```bash+launchctl bootout "gui/$(id -u)/com.trycua.lume.metal-workload"+/absolute/path/to/your-workload first-argument+```++## Remove the configuration++For a one-shot command, omit `DYLD_INSERT_LIBRARIES` and all `LUME_METAL_*` variables the next time+you start the workload.++For the LaunchAgent:++```bash+SERVICE="gui/$(id -u)/com.trycua.lume.metal-workload"+PLIST="$HOME/Library/LaunchAgents/com.trycua.lume.metal-workload.plist"++launchctl bootout "$SERVICE"+mv "$PLIST" "$HOME/.Trash/com.trycua.lume.metal-workload.plist"+```++Restore the host preference with the earlier `defaults delete` sequence if you no longer need the+unrestricted feature level.++## Limitations++- **Experimental and version-sensitive.** The shim relies on private guest Metal implementation+ details that may change in any macOS release.+- **Per-process, not global.** Only an injected process and its children receive changed answers.+- **Configured profile, not hardware discovery.** The shim raises selected Apple-family values; it+ does not mirror every property of the physical GPU.+- **Narrow test scope.** The current release-candidate evidence covers a capability probe, two+ llama.cpp workloads, and one MLX-LM compatibility run on the documented M1 Ultra/Tahoe+ configuration. MLX-LM was already fast in the stock VM and showed no material uplift.+- **Reported support is not complete support.** A positive family response does not establish that+ every shader, renderer, framework, or API in that family works correctly in the VM.+- **Still a VM.** Existing `Virtualization.framework` limits remain.++## See also++- [Lume source tree](https://github.com/trycua/cua/tree/main/libs/lume)+- [Technical writeup and benchmark evidence](/blog/gpu-passthrough-macos-vms)+- [Install and run Lume](/how-to-guides/lume/install-lume)+- [How SIP works in Lume VMs](/concepts/how-sip-works-in-lume-vms)diff --git a/docs/content/docs/how-to-guides/lume/meta.json b/docs/content/docs/how-to-guides/lume/meta.jsonindex 2f302f9023..935b9d9e0d 100644--- a/docs/content/docs/how-to-guides/lume/meta.json+++ b/docs/content/docs/how-to-guides/lume/meta.json@@ -7,6 +7,7 @@"manage-vms","expand-vm-disk","change-sip",+ "gpu-passthrough","serve-api","use-mcp-server"]diff --git a/docs/scripts/check-links.ts b/docs/scripts/check-links.tsindex 93f2759532..e83bf972ed 100644--- a/docs/scripts/check-links.ts+++ b/docs/scripts/check-links.ts@@ -18,6 +18,7 @@ import fg from 'fast-glob';const DOCS_DIR = path.resolve(__dirname, '..');const CONTENT_DIR = path.join(DOCS_DIR, 'content/docs');+const BLOG_DIR = path.join(DOCS_DIR, '../blog');/*** Build the ScanResult (valid URL map) directly from content files.@@ -32,6 +33,14 @@ function buildScannedUrls(): ScanResult {urls.set(`/${slug}`, {});}+ // Blog posts share the cua.ai origin with the docs app, so root-relative+ // links from docs pages should be checked against the repository's posts.+ const blogFiles = fg.sync('**/*.md', { cwd: BLOG_DIR });+ for (const file of blogFiles) {+ const slug = file.replace(/\.md$/, '').replace(/\/index$/, '');+ urls.set(`/blog/${slug}`, {});+ }+// Also add the rooturls.set('/', {});diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/README.md b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/README.mdnew file mode 100644index 0000000000..74001a228b--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/README.md@@ -0,0 +1,46 @@+# M1 Ultra validation, 2026-08-09++This is a fresh stock-versus-safe-shim validation. It is independent of the historical M5 Max benchmark set and must not be presented as a reproduction of the M5 absolute numbers.++## Result++| Workload | Bare-metal host | Stock guest | Safe-shim guest | Guest speedup | Shim/host |+| ---------------------------- | --------------: | -----------: | --------------: | ------------: | --------: |+| TinyLlama 1.1B Q4_K_M, pp512 | 4,871.99 tok/s | 431.86 tok/s | 4,786.70 tok/s | 11.08× | 98.25% |+| TinyLlama 1.1B Q4_K_M, tg128 | 286.71 tok/s | 12.63 tok/s | 206.60 tok/s | 16.36× | 72.06% |++Values are medians of the ten `samples_ts` values emitted by `llama-bench` for each row.++The guest capability probe also changed as expected:++| Capability | Stock | Safe shim |+| -------------------------- | -----------: | -----------: |+| `supportsFamily:1009` | `false` | `true` |+| Maximum threadgroup memory | 32,768 bytes | 65,536 bytes |++A malformed `LUME_METAL_APPLE_FAMILY_MAX` produced the stock result, confirming fail-closed activation.++## MLX-LM compatibility result++We also ran ten repetitions of MLX-LM 0.31.3 with MLX 0.32.0 and+`mlx-community/Llama-3.2-3B-Instruct-4bit` at the same 512-token prompt and 128-token generation+sizes:++| Workload | Stock guest | Safe-shim guest | Ratio |+| ----------------- | -------------: | --------------: | -----: |+| Prompt processing | 1,656.55 tok/s | 1,665.47 tok/s | 1.005× |+| Token generation | 172.09 tok/s | 170.86 tok/s | 0.993× |++The safe profile produced no material MLX-LM speed change, while confirming that MLX-LM remained+operational. A broader research profile that advertised `MTLGPUFamilyMetal3` failed during MLX+device initialization because the paravirtualized device could not create the residency set that+MLX requests on that path. That failure is why the release shim changes Apple-family answers only.++## Important scope++- This run proves the reduced shim activates the intended llama.cpp fast paths without a private feature-profile hook or the research hook’s timing, mesh, ray-tracing, argument-layout, or pipeline fallbacks.+- It does not validate every Metal feature or workload.+- The official `llama.cpp b10167` release binary used here has a different SHA-256 from the historical handoff binary. Keep this evidence series separate from the M5 tables.+- The final ten-repeat llama.cpp and MLX-LM runs use the Apple-family-only candidate at `5336ee9b61f35ffa058c746af237cb334e58bab9`. Earlier `tiny-hooked-minimal` and `candidate-hooked-smoke` files used the superseded broader profile and are retained only as development history; they are not headline evidence.++See [metadata.md](metadata.md) for the exact environment and hashes. Raw JSON and stderr are retained beside this file.diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/SHA256SUMS b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/SHA256SUMSnew file mode 100644index 0000000000..5fa294c96c--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/SHA256SUMS@@ -0,0 +1,13 @@+77ea18086bba933176cdf2a830c0af1554d5746204c068b718ea4eab67530409 candidate-hooked-smoke.stderr+0eab424c8509d9caf6d8b05640c9021d233a2b99e624569b085a76669bb96fc6 candidate-hooked-smoke.txt+f490ea6d8a54a631bed292140d54692b22a6e8678da37f2aed183c06a9774bc3 mlx-broad-profile-failure.stderr+415b4dcad9560d4b6e82a020f575b6cd3e9caa5065e84b82d6c197e2356dbc82 mlx-safe-shim-10x.json+df85c572c1af8ad4b14f8290ad8aeea6e4be84866b528b2b6382e0e0cf6e897e mlx-stock-10x.json+49bdd1fe4b67a039145d57fde9d69c072fbee56e37a00ad4b48201b47b9fa2b7 tiny-hooked-minimal.json+0d44f1a0c92b7fec62e12ec5e060bc5e26d423b68264598bf49d7df585ac76b5 tiny-hooked-minimal.stderr+cdc70b7ffe0e5e43feaf62c886b06fc150f4a0828032b3c4f3ca0b3acb15afdc tiny-host-minimal.json+e68c8cd0636300ab2a6a3a448e5e564ae993184b7b60b1ae7cb42df6623a1ef7 tiny-host-minimal.stderr+406f340fc6c3994dab10771525b276b61e56df7c3490b7c7df4cf24124a23354 tiny-safe-shim-10x-final.json+2dea6144267a47fea41e8e3ea811a69320aa2ea5459fd240ac8b1350e36fc36a tiny-safe-shim-10x-final.stderr+85966786cf1d83ffea629d43dab5e21ff1a4e0e7c94f57e670293be9130a47f8 tiny-stock-minimal.json+a86e50ad8aa72d5314ef806b53ab72e75e374d09d3c2a2417d93c4b2c8ebc706 tiny-stock-minimal.stderrdiff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.stderrnew file mode 100644index 0000000000..23e3aa0a10--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.stderr@@ -0,0 +1,17 @@+2026-08-09 11:37:58.115 llama-bench[1571:29020] [LumeMetalCapabilities] Enabled for llama-bench (familyMax=5001 featureProfile=10 maxThreadgroupMemory=65536)+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 0.015 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple21 (1021)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon6 (3006)+ggml_metal_device_init: GPU family: MTLGPUFamilyMetal4 (5002)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.txt b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.txtnew file mode 100644index 0000000000..d65a7b59ea--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/candidate-hooked-smoke.txt@@ -0,0 +1,6 @@+| model | size | params | backend | threads | test | t/s |+| ------------------------------ | ---------: | ---------: | ---------- | ------: | --------------: | -------------------: |+| llama 1B Q4_K - Medium | 636.18 MiB | 1.10 B | MTL,BLAS | 8 | pp512 | 4785.97 ± 0.00 |+| llama 1B Q4_K - Medium | 636.18 MiB | 1.10 B | MTL,BLAS | 8 | tg128 | 192.89 ± 0.00 |++build: ee3d1b54c (10167)diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/metadata.md b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/metadata.mdnew file mode 100644index 0000000000..0f7e05690a--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/metadata.md@@ -0,0 +1,64 @@+# Environment and provenance++## Host++- Model: `Mac13,2`+- Chip: Apple M1 Ultra, 48-core GPU+- CPU cores: 20+- Memory: 128 GiB+- macOS: 26.6.1 (`25G76`)+- Metal: Metal 4++## Guest++- Image reference: `ghcr.io/trycua/macos-tahoe-cua:latest`+- Pulled manifest: `sha256:ed1783e80e08e888889b54a8c0387105a37fbcfc995079f76db48e2280081487`+- macOS: 26.5.2 (`25F84`)+- Virtual hardware: `VirtualMac2,1`+- CPU: 8 vCPU+- Memory: 16 GiB+- SIP: disabled in the published test image+- Lume: 0.5.1, official Developer ID-signed and notarized release++## Workload++- `llama.cpp`: official release `b10167`, build commit `ee3d1b54c`+- `llama-bench` SHA-256: `28faa552714d0d8150b1daa4e991181d62084c88e25afe9d49d08351794f0da7`+- Model: `tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf`+- Model SHA-256: `9fecc3b3cd76bba89d504f29b616eedf7da85b96540e490ca5824d3f7d2776a0`+- Command: `llama-bench -p 512 -n 128 -r 10 -t 8 -ngl -1 -o json`++### MLX-LM compatibility run++- Python: 3.12.13+- MLX: 0.32.0+- MLX-LM: 0.31.3+- Model: `mlx-community/Llama-3.2-3B-Instruct-4bit`+- Model revision: `7f0dc925e0d0afb0322d96f9255cfddf2ba5636e`+- Configuration: 512 prompt tokens, 128 generated tokens, 10 repetitions, seed 42, EOS stopping disabled+- Harness SHA-256: `1daee0e796a62744c1288ea77b29de07d6f2a92434a35c5cf1b261c725aacee4`++## Shim++- Safe-profile artifact revision: `5336ee9b61f35ffa058c746af237cb334e58bab9`+- Source SHA-256: `a0d055caa64afe60d1139ded329d4062f271ab6f1a7f24e6f5738a6f3da4fd40`+- Build script SHA-256: `f60b741bca2005d22f4af5f1398614e4f5aa1d49171cc73cd5d1d20bf60cb264`+- Verification script SHA-256: `806896603e01be50a9c3e74ac3d87cc1f8ac59699a853f5949b188b40daa0b7a`+- Capability probe source SHA-256: `481dd635efcbee2b614b5ae47defa277a792cb91e3f99e5d0954400a5a787edc`+- Capability probe binary SHA-256: `6e0f26c6c138b4c31379fb659cb5748d98db993d4d19c8db0f0e4a44ed714396`+- `arm64` dylib SHA-256: `515b9d84ab67e86d959282e95c194a5ad8a947261514b947d6f7483c57797b31`+- `arm64e` dylib SHA-256: `62504be341ed74191eab22f19e21d99b2afbe6cc029902c760578ffbbd0588cb`+- Build toolchain: Command Line Tools `26.4.0.0.1774242506`, Apple clang `21.0.0` (`clang-2100.0.123.102`), macOS SDK `26.4`+- Binary load-command metadata: deployment target `13.0`, macOS SDK `26.4`, linker `1266.8`+- Activation: `DYLD_INSERT_LIBRARIES=<arm64 dylib> LUME_METAL_APPLE_FAMILY_MAX=1009`++The exact artifact pair was recovered from two independently retained local build sets. A clean+rebuild from the frozen source revision using the pinned Command Line Tools 26.4 installation also+reproduced both dylibs and the capability probe byte-for-byte on 2026-08-10. The committed release+manifest and provenance record define the local release-asset set.++The safe-profile capability probe reported `supports_family=true` for family `1009` and 65,536 bytes+of maximum threadgroup memory. `tiny-safe-shim-10x-final.json`, `mlx-stock-10x.json`, and+`mlx-safe-shim-10x.json` are the sources for the published medians. The broad-profile MLX failure is+retained in `mlx-broad-profile-failure.stderr` as the negative control that motivated the narrower+family policy.diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-broad-profile-failure.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-broad-profile-failure.stderrnew file mode 100644index 0000000000..ff4b1b0331--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-broad-profile-failure.stderr@@ -0,0 +1,6 @@+2026-08-09 12:42:20.357 python[2758:55059] [LumeMetalCapabilities] Enabled for python (familyMax=5001 featureProfile=10 maxThreadgroupMemory=65536)+Traceback (most recent call last):+ File "<string>", line 1, in <module>+RuntimeError: [metal::Device] Unable to construct residency set.+Exception ignored in atexit callback: <nanobind.nb_func object at 0x108997bc0>+RuntimeError: [metal::Device] Unable to construct residency set.diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-safe-shim-10x.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-safe-shim-10x.jsonnew file mode 100644index 0000000000..0b4ae4ab25--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-safe-shim-10x.json@@ -0,0 +1,129 @@+{+ "schema_version": 1,+ "runtime": {+ "python": "3.12.13",+ "mlx": "0.32.0",+ "mlx_lm": "0.31.3",+ "platform": "macOS-26.5.2-arm64-64bit"+ },+ "model": {+ "id": "mlx-community/Llama-3.2-3B-Instruct-4bit",+ "revision": "7f0dc925e0d0afb0322d96f9255cfddf2ba5636e",+ "path": "/Users/lume/gpu-test/hf-cache/hub/models--mlx-community--Llama-3.2-3B-Instruct-4bit/snapshots/7f0dc925e0d0afb0322d96f9255cfddf2ba5636e"+ },+ "configuration": {+ "prompt_tokens": 512,+ "generation_tokens": 128,+ "repeats": 10,+ "warmup_prompt_tokens": 64,+ "warmup_generation_tokens": 16,+ "seed": 42,+ "eos_stopping": false+ },+ "warmup": {+ "prompt_tokens": 64,+ "prompt_tps": 103.96916502000245,+ "generation_tokens": 16,+ "generation_tps": 190.574692635745,+ "peak_memory_gb": 1.995521324,+ "finish_reason": "length",+ "wall_seconds": 0.7747689580000952+ },+ "samples": [+ {+ "prompt_tokens": 512,+ "prompt_tps": 1677.5055586733681,+ "generation_tokens": 128,+ "generation_tps": 170.77059013399605,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1254957080000167+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1658.3709896927053,+ "generation_tokens": 128,+ "generation_tps": 170.64179096159054,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1231991670001662+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1669.338178330432,+ "generation_tokens": 128,+ "generation_tps": 170.80659507316423,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1202187910002976+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1663.7898808081745,+ "generation_tokens": 128,+ "generation_tps": 171.28105179954966,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1213213340006405+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1629.4627228577083,+ "generation_tokens": 128,+ "generation_tps": 170.71436221089692,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1276117079996766+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1683.6712253746923,+ "generation_tokens": 128,+ "generation_tps": 171.38233071596468,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1189426250002725+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1691.7510614760251,+ "generation_tokens": 128,+ "generation_tps": 170.68408600174493,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1189154590001635+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1667.1442340231151,+ "generation_tokens": 128,+ "generation_tps": 170.91435940239944,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1321065420006562+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1645.1098582534548,+ "generation_tokens": 128,+ "generation_tps": 171.76700610765698,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1211422499991386+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1642.8921086346074,+ "generation_tokens": 128,+ "generation_tps": 171.9555498611384,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1196406249991924+ }+ ],+ "median": {+ "prompt_tps": 1665.4670574156448,+ "generation_tps": 170.86047723778182,+ "peak_memory_gb": 2.339749012+ }+}diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-stock-10x.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-stock-10x.jsonnew file mode 100644index 0000000000..f1925101a1--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/mlx-stock-10x.json@@ -0,0 +1,129 @@+{+ "schema_version": 1,+ "runtime": {+ "python": "3.12.13",+ "mlx": "0.32.0",+ "mlx_lm": "0.31.3",+ "platform": "macOS-26.5.2-arm64-arm-64bit"+ },+ "model": {+ "id": "mlx-community/Llama-3.2-3B-Instruct-4bit",+ "revision": "7f0dc925e0d0afb0322d96f9255cfddf2ba5636e",+ "path": "/Users/lume/gpu-test/hf-cache/hub/models--mlx-community--Llama-3.2-3B-Instruct-4bit/snapshots/7f0dc925e0d0afb0322d96f9255cfddf2ba5636e"+ },+ "configuration": {+ "prompt_tokens": 512,+ "generation_tokens": 128,+ "repeats": 10,+ "warmup_prompt_tokens": 64,+ "warmup_generation_tokens": 16,+ "seed": 42,+ "eos_stopping": false+ },+ "warmup": {+ "prompt_tokens": 64,+ "prompt_tps": 118.43100217502753,+ "generation_tokens": 16,+ "generation_tps": 194.54247561318635,+ "peak_memory_gb": 1.99056918,+ "finish_reason": "length",+ "wall_seconds": 0.6851541249998263+ },+ "samples": [+ {+ "prompt_tokens": 512,+ "prompt_tps": 1636.71898223661,+ "generation_tokens": 128,+ "generation_tps": 172.4786507912141,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1206447080003272+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1692.6193366885493,+ "generation_tokens": 128,+ "generation_tps": 172.3167333360578,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1091972920003172+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1610.4397562394088,+ "generation_tokens": 128,+ "generation_tps": 172.17668488933333,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.124530582999796+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1655.5075755857774,+ "generation_tokens": 128,+ "generation_tps": 172.19483845982734,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1174945420007134+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1665.54211670218,+ "generation_tokens": 128,+ "generation_tps": 171.9979401257489,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1161925839996911+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1668.053540243598,+ "generation_tokens": 128,+ "generation_tps": 172.02612213453,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1158487080001578+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1656.2691566773349,+ "generation_tokens": 128,+ "generation_tps": 171.9599199044048,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.117511707999256+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1641.623707695512,+ "generation_tokens": 128,+ "generation_tps": 171.13124990501328,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.123067374999664+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1656.838625700112,+ "generation_tokens": 128,+ "generation_tps": 172.15023836971372,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1157241250002699+ },+ {+ "prompt_tokens": 512,+ "prompt_tps": 1674.752170619572,+ "generation_tokens": 128,+ "generation_tps": 171.89062347686843,+ "peak_memory_gb": 2.339749012,+ "finish_reason": "length",+ "wall_seconds": 1.1167092089999642+ }+ ],+ "median": {+ "prompt_tps": 1656.5538911887234,+ "generation_tps": 172.08818025212184,+ "peak_memory_gb": 2.339749012+ }+}diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/results.csv b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/results.csvnew file mode 100644index 0000000000..e3ff446911--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/results.csv@@ -0,0 +1,5 @@+workload,metric,unit,host_baremetal,stock_guest,safe_shim_guest,guest_ratio,shim_to_host_percent+TinyLlama 1.1B Q4_K_M (llama.cpp),pp512,tokens/s,4871.99,431.8625,4786.7,11.0839,98.2494+TinyLlama 1.1B Q4_K_M (llama.cpp),tg128,tokens/s,286.7055,12.6307,206.5965,16.3567,72.0588+Llama-3.2-3B-Instruct-4bit (MLX-LM),pp512,tokens/s,,1656.5539,1665.4671,1.0054,+Llama-3.2-3B-Instruct-4bit (MLX-LM),tg128,tokens/s,,172.0882,170.8605,0.9929,diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.jsonnew file mode 100644index 0000000000..6c26c84c03--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.json@@ -0,0 +1,90 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-09T18:15:22Z",+ "avg_ns": 106146866,+ "stddev_ns": 505652,+ "avg_ts": 4823.603435,+ "stddev_ts": 22.836169,+ "samples_ns": [ 107359417, 105794333, 106110000, 106116083, 106540833, 105863541, 105477167, 106043000, 106075625, 106088666 ],+ "samples_ts": [ 4769.03, 4839.58, 4825.18, 4824.9, 4805.67, 4836.41, 4854.13, 4828.23, 4826.75, 4826.15 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-09T18:15:24Z",+ "avg_ns": 620735129,+ "stddev_ns": 32970455,+ "avg_ts": 206.702339,+ "stddev_ts": 10.370518,+ "samples_ns": [ 693264791, 661525167, 618518041, 595804417, 626525125, 614083542, 595416375, 614678292, 590402375, 597133167 ],+ "samples_ts": [ 184.634, 193.492, 206.946, 214.836, 204.301, 208.441, 214.976, 208.239, 216.801, 214.358 ]+ }+]diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.stderrnew file mode 100644index 0000000000..78ecaa5711--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-hooked-minimal.stderr@@ -0,0 +1,17 @@+2026-08-09 11:15:12.566 llama-bench[932:16029] [LumeMetalCapabilities] Enabled for llama-bench (familyMax=5001 featureProfile=10 maxThreadgroupMemory=65536)+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 10.080 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple21 (1021)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon6 (3006)+ggml_metal_device_init: GPU family: MTLGPUFamilyMetal4 (5002)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.jsonnew file mode 100644index 0000000000..86aa7dcda4--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.json@@ -0,0 +1,90 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra",+ "gpu_info": "Apple M1 Ultra",+ "backends": "MTL,BLAS",+ "model_filename": "../../models/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-09T18:16:13Z",+ "avg_ns": 105167454,+ "stddev_ns": 241350,+ "avg_ts": 4868.449329,+ "stddev_ts": 11.145173,+ "samples_ns": [ 105525416, 105041333, 105072958, 105662167, 105032791, 104893875, 105108084, 105000209, 105136791, 105200916 ],+ "samples_ts": [ 4851.91, 4874.27, 4872.8, 4845.63, 4874.67, 4881.12, 4871.18, 4876.18, 4869.85, 4866.88 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra",+ "gpu_info": "Apple M1 Ultra",+ "backends": "MTL,BLAS",+ "model_filename": "../../models/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-09T18:16:14Z",+ "avg_ns": 446526812,+ "stddev_ns": 1851915,+ "avg_ts": 286.661352,+ "stddev_ts": 1.188010,+ "samples_ns": [ 447795625, 446182291, 444205666, 444662458, 444173375, 446910792, 449429417, 449005583, 446408250, 446494667 ],+ "samples_ts": [ 285.845, 286.878, 288.155, 287.859, 288.176, 286.411, 284.806, 285.074, 286.733, 286.678 ]+ }+]diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.stderrnew file mode 100644index 0000000000..af87925b47--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-host-minimal.stderr@@ -0,0 +1,16 @@+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 10.634 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple M1 Ultra)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple7 (1007)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: GPU family: MTLGPUFamilyMetal4 (5002)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 115448.73 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.jsonnew file mode 100644index 0000000000..f0764dd2ad--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.json@@ -0,0 +1,90 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "../tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-09T19:41:47Z",+ "avg_ns": 106985262,+ "stddev_ns": 559134,+ "avg_ts": 4785.823751,+ "stddev_ts": 25.060378,+ "samples_ns": [ 106978708, 106947333, 106859958, 105963458, 107500500, 107410542, 106508000, 106455333, 107665458, 107563333 ],+ "samples_ts": [ 4786, 4787.4, 4791.32, 4831.85, 4762.77, 4766.76, 4807.15, 4809.53, 4755.47, 4759.99 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "../tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-09T19:41:48Z",+ "avg_ns": 625275787,+ "stddev_ns": 22121596,+ "avg_ts": 204.935887,+ "stddev_ts": 7.108683,+ "samples_ns": [ 637877667, 619311958, 613500750, 637443250, 646568916, 619818166, 605837125, 669075291, 605442708, 597882041 ],+ "samples_ts": [ 200.665, 206.681, 208.639, 200.802, 197.968, 206.512, 211.278, 191.309, 211.416, 214.089 ]+ }+]diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.stderrnew file mode 100644index 0000000000..8156a5cb67--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-safe-shim-10x-final.stderr@@ -0,0 +1,16 @@+2026-08-09 12:41:47.024 llama-bench[2738:54808] [LumeMetalCapabilities] Enabled for llama-bench (appleFamilyMax=1009 maxThreadgroupMemory=65536)+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 0.011 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple9 (1009)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.json b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.jsonnew file mode 100644index 0000000000..e504ac0bfe--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.json@@ -0,0 +1,90 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-09T18:13:03Z",+ "avg_ns": 1187070466,+ "stddev_ns": 5614648,+ "avg_ts": 431.322577,+ "stddev_ts": 2.036988,+ "samples_ns": [ 1180977334, 1184324459, 1192016083, 1182940667, 1180308667, 1183085959, 1186804250, 1192277167, 1196545750, 1191424333 ],+ "samples_ts": [ 433.539, 432.314, 429.524, 432.82, 433.785, 432.767, 431.411, 429.43, 427.898, 429.738 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",+ "model_type": "llama 1B Q4_K - Medium",+ "model_size": 667078656,+ "model_n_params": 1100048384,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-09T18:13:16Z",+ "avg_ns": 10819669895,+ "stddev_ns": 488240790,+ "avg_ts": 11.996419,+ "stddev_ts": 1.326353,+ "samples_ns": [ 10661883334, 10088919333, 11858498417, 10118406667, 10392456834, 10044862583, 10053199500, 10149712417, 10010531958, 14818227916 ],+ "samples_ts": [ 12.0054, 12.6872, 10.7939, 12.6502, 12.3166, 12.7428, 12.7323, 12.6112, 12.7865, 8.63801 ]+ }+]diff --git a/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.stderr b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.stderrnew file mode 100644index 0000000000..468af38892--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-09-m1-ultra/tiny-stock-minimal.stderr@@ -0,0 +1,15 @@+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 8.931 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple5 (1005)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: simdgroup reduction = false+ggml_metal_device_init: simdgroup matrix mul. = false+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = false+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/README.md b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/README.mdnew file mode 100644index 0000000000..ef5a0a821a--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/README.md@@ -0,0 +1,42 @@+# M1 Ultra Gemma 4 validation, 2026-08-10++This evidence series tests the Apple-family-only shim with a current, larger model: Google's official+Gemma 4 12B instruction-tuned QAT Q4_0 GGUF. It uses the same M1 Ultra host, Tahoe guest, llama.cpp+release, benchmark shape, and safe shim as the TinyLlama launch evidence.++## Result++| Workload | Bare-metal host | Stock guest | Safe-shim guest | Guest speedup | Shim / host |+| --------------------------- | --------------: | ----------: | --------------: | ------------: | ----------: |+| Gemma 4 12B QAT Q4_0, pp512 | 517.88 tok/s | 71.66 tok/s | 515.76 tok/s | 7.20× | 99.59% |+| Gemma 4 12B QAT Q4_0, tg128 | 52.38 tok/s | 3.41 tok/s | 49.67 tok/s | 14.54× | 94.82% |++Values are medians of the ten `samples_ts` values emitted by `llama-bench` for each row.++The final sample ranges were:++| Workload | Bare-metal host | Stock guest | Safe-shim guest |+| ----------------- | --------------: | ----------: | --------------: |+| Prompt processing | 516.33–518.29 | 69.94–72.77 | 514.14–516.54 |+| Token generation | 51.92–52.52 | 3.37–3.50 | 49.52–49.79 |++## Measurement hygiene++A preliminary stock run overlapped with a separate host compute workload. Its prompt results were+lower and its generation samples ranged from 0.55 to 3.45 tok/s. We rejected that run before using+or copying it into the public evidence set. After the competing process exited, we reran the stock,+safe-shim, and bare-metal legs in the same uncontended window. The final files in this directory are+only from that window. macOS reported no thermal or performance warning during the final runs.++## Important scope++- The result validates one official Gemma 4 quantization through llama.cpp's Metal backend. It does+ not establish the same speedup for other Gemma variants, runtimes, context sizes, or modalities.+- Speculative decoding and the multimodal projector were deliberately excluded so the comparison+ isolates the same Metal capability path as the TinyLlama benchmark.+- The final guest runs use the evidence-matched Apple-family-only dylib at revision+ `5336ee9b61f35ffa058c746af237cb334e58bab9`.+- The safe-shim stderr records Apple family 9, SIMD-group matrix and reduction support, and bfloat16.+ The stock stderr records Apple family 5 with those fast paths disabled.++See [metadata.md](metadata.md) for exact environment, command, revision, and artifact hashes.diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/SHA256SUMS b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/SHA256SUMSnew file mode 100644index 0000000000..79161fc337--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/SHA256SUMS@@ -0,0 +1,9 @@+32252243be0d6878679926fc72cc5df09894ae52195f838fcb3ed458e99492f8 README.md+f58ad06081d31963af73601a15a52c3954449552f41a4bf7ba7fa2da8f4f33d7 metadata.md+b050a592ad2df6121c3d798fb21dc56085fe0dcce44489e114b9f5ec2a91ca98 results.csv+59e80680371800bf550f18faaca998df927a692645a08f9ebe2c76ac378ae794 gemma4-host-10x.json+526f11cdbc25dd78c0f941197832b8ac8dc830a7c8849439044731c1af094abb gemma4-host-10x.stderr+eac40a82e0c53c518dbedaf63675c843ac15759b7aeecbe351a44766bd80c733 gemma4-stock-10x.json+f1917fe8ce3ceff184c13326b42a143fc14fc329b9c6dcfa9b7c9071d2dd2cb9 gemma4-stock-10x.stderr+781f5fec78d719ac3ebda667df2584d294f84a375b8e1667bb5276a210db016a gemma4-safe-shim-10x.json+44631b0d2142f52cf920495918627388634f5115d053aa6924d4903bf9ae2d4e gemma4-safe-shim-10x.stderrdiff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.json b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.jsonnew file mode 100644index 0000000000..d034074c48--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.json@@ -0,0 +1,90 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra",+ "gpu_info": "Apple M1 Ultra",+ "backends": "MTL,BLAS",+ "model_filename": "../../models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-10T12:56:53Z",+ "avg_ns": 988940554,+ "stddev_ns": 1096476,+ "avg_ts": 517.726332,+ "stddev_ts": 0.573097,+ "samples_ns": [ 988690041, 988604666, 987938250, 988092583, 988611875, 991611542, 989155625, 989493584, 987862791, 989344584 ],+ "samples_ts": [ 517.857, 517.902, 518.251, 518.17, 517.898, 516.331, 517.613, 517.436, 518.291, 517.514 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra",+ "gpu_info": "Apple M1 Ultra",+ "backends": "MTL,BLAS",+ "model_filename": "../../models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-10T12:57:04Z",+ "avg_ns": 2444952629,+ "stddev_ns": 8054259,+ "avg_ts": 52.353261,+ "stddev_ts": 0.171517,+ "samples_ns": [ 2439943000, 2465562583, 2448447042, 2438240459, 2441833583, 2443589542, 2444048875, 2437304542, 2446949542, 2443607125 ],+ "samples_ts": [ 52.4602, 51.9151, 52.278, 52.4969, 52.4196, 52.382, 52.3721, 52.517, 52.31, 52.3816 ]+ }+]diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.stderr b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.stderrnew file mode 100644index 0000000000..126b9f471e--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-host-10x.stderr@@ -0,0 +1,16 @@+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 0.012 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple M1 Ultra)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple7 (1007)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: GPU family: MTLGPUFamilyMetal4 (5002)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 115448.73 MBdiff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.json b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.jsonnew file mode 100644index 0000000000..cd54354911--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.json@@ -0,0 +1,91 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-10T12:56:07Z",+ "avg_ns": 993062412,+ "stddev_ns": 1601813,+ "avg_ts": 515.578065,+ "stddev_ts": 0.830612,+ "samples_ns": [ 995426916, 994217125, 991935000, 992886083, 992532625, 995843542, 992311875, 992876000, 991218292, 991376667 ],+ "samples_ts": [ 514.352, 514.978, 516.163, 515.668, 515.852, 514.137, 515.967, 515.674, 516.536, 516.454 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-10T12:56:19Z",+ "avg_ns": 2577210899,+ "stddev_ns": 4489229,+ "avg_ts": 49.666230,+ "stddev_ts": 0.086480,+ "samples_ns": [ 2577296416, 2577033083, 2576116125, 2584973500, 2577856416, 2573478958, 2571808791, 2581651125, 2581115041, 2570779542 ],+ "samples_ts": [ 49.6644, 49.6695, 49.6872, 49.5169, 49.6537, 49.7381, 49.7704, 49.5807, 49.591, 49.7903 ]+ }+]+diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.stderr b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.stderrnew file mode 100644index 0000000000..1e50ed3cf9--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-safe-shim-10x.stderr@@ -0,0 +1,17 @@+2026-08-10 05:56:06.624 llama-bench[13495:456681] [LumeMetalCapabilities] Enabled for llama-bench (appleFamilyMax=1009 maxThreadgroupMemory=65536)+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 0.012 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple9 (1009)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: simdgroup reduction = true+ggml_metal_device_init: simdgroup matrix mul. = true+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = true+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MB+diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.json b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.jsonnew file mode 100644index 0000000000..f6f8ef0792--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.json@@ -0,0 +1,91 @@+[+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 512,+ "n_gen": 0,+ "n_depth": 0,+ "test_time": "2026-08-10T12:47:31Z",+ "avg_ns": 7149882512,+ "stddev_ns": 101008175,+ "avg_ts": 71.622375,+ "stddev_ts": 1.007282,+ "samples_ns": [ 7320590292, 7201326542, 7056223209, 7107321000, 7035932542, 7058223416, 7268839334, 7211731333, 7183437000, 7055200459 ],+ "samples_ts": [ 69.9397, 71.098, 72.5601, 72.0384, 72.7693, 72.5395, 70.4377, 70.9954, 71.2751, 72.5706 ]+ },+ {+ "build_commit": "ee3d1b54c",+ "build_number": 10167,+ "cpu_info": "Accelerate, Apple M1 Ultra (Virtual)",+ "gpu_info": "Apple Paravirtual device",+ "backends": "MTL,BLAS",+ "model_filename": "/Users/lume/gpu-test/models/gemma-4-12b/gemma-4-12b-it-qat-q4_0.gguf",+ "model_type": "gemma4 ?B Q4_0",+ "model_size": 6960054464,+ "model_n_params": 11907350576,+ "n_batch": 2048,+ "n_ubatch": 512,+ "n_threads": 8,+ "cpu_mask": "0x0",+ "cpu_strict": false,+ "poll": 50,+ "type_k": "f16",+ "type_v": "f16",+ "n_gpu_layers": -1,+ "n_cpu_moe": 0,+ "split_mode": "layer",+ "main_gpu": 0,+ "no_kv_offload": false,+ "flash_attn": -1,+ "devices": "auto",+ "tensor_split": "0.00",+ "tensor_buft_overrides": "none",+ "load_mode": "mmap",+ "embeddings": false,+ "no_op_offload": 0,+ "no_host": false,+ "fit_target": 0,+ "fit_min_ctx": 0,+ "n_prompt": 0,+ "n_gen": 128,+ "n_depth": 0,+ "test_time": "2026-08-10T12:48:55Z",+ "avg_ns": 37334800512,+ "stddev_ns": 488737831,+ "avg_ts": 3.428969,+ "stddev_ts": 0.045180,+ "samples_ns": [ 37195424375, 37407146917, 37010293166, 36537613541, 36606102083, 37934604542, 37580113875, 37648700041, 37867695500, 37560311084 ],+ "samples_ts": [ 3.44128, 3.42181, 3.4585, 3.50324, 3.49668, 3.37423, 3.40606, 3.39985, 3.38019, 3.40785 ]+ }+]+diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.stderr b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.stderrnew file mode 100644index 0000000000..158397bd45--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/gemma4-stock-10x.stderr@@ -0,0 +1,16 @@+ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices+ggml_metal_library_init: using embedded metal library+ggml_metal_library_init: loaded in 0.011 sec+ggml_metal_rsets_init: creating a residency set collection (keep_alive = 180 s)+ggml_metal_device_init: GPU name: MTL0 (Apple Paravirtual device)+ggml_metal_device_init: GPU family: MTLGPUFamilyApple5 (1005)+ggml_metal_device_init: GPU family: MTLGPUFamilyCommon3 (3003)+ggml_metal_device_init: simdgroup reduction = false+ggml_metal_device_init: simdgroup matrix mul. = false+ggml_metal_device_init: has unified memory = true+ggml_metal_device_init: has bfloat = false+ggml_metal_device_init: has tensor = false+ggml_metal_device_init: use residency sets = true+ggml_metal_device_init: use shared buffers = true+ggml_metal_device_init: recommendedMaxWorkingSetSize = 11453.25 MB+diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/metadata.md b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/metadata.mdnew file mode 100644index 0000000000..f23f5f04d5--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/metadata.md@@ -0,0 +1,54 @@+# Environment and provenance++## Host++- Model: `Mac13,2`+- Chip: Apple M1 Ultra, 48-core GPU+- CPU cores: 20+- Memory: 128 GiB+- macOS: 26.6.1 (`25G76`)+- Metal: Metal 4+- Thermal state during final runs: no thermal or performance warning reported++## Guest++- Image reference: `ghcr.io/trycua/macos-tahoe-cua:latest`+- Pulled manifest: `sha256:ed1783e80e08e888889b54a8c0387105a37fbcfc995079f76db48e2280081487`+- macOS: 26.5.2 (`25F84`)+- Virtual hardware: `VirtualMac2,1`+- CPU: 8 vCPU+- Memory: 16 GiB+- SIP: disabled in the published test image+- Lume: 0.5.1, official Developer ID-signed and notarized release++## Workload++- `llama.cpp`: official release `b10167`, build commit `ee3d1b54c`+- `llama-bench` SHA-256: `28faa552714d0d8150b1daa4e991181d62084c88e25afe9d49d08351794f0da7`+- Model repository: `google/gemma-4-12B-it-qat-q4_0-gguf`+- Model revision: `29d097773436b69ff9feafd636ab4cf873786537`+- Model file: `gemma-4-12b-it-qat-q4_0.gguf`+- Model file size: 6,975,879,296 bytes+- Model SHA-256: `93567e57a8fe10b23569b9d9ec38cd005deedf71e29477c421a4b83f418a538b`+- Command: `llama-bench -p 512 -n 128 -r 10 -t 8 -ngl -1 -o json`+- Speculative decoding: disabled+- Multimodal projector: not loaded++## Shim++- Safe-profile artifact revision: `5336ee9b61f35ffa058c746af237cb334e58bab9`+- Source SHA-256: `a0d055caa64afe60d1139ded329d4062f271ab6f1a7f24e6f5738a6f3da4fd40`+- Build script SHA-256: `f60b741bca2005d22f4af5f1398614e4f5aa1d49171cc73cd5d1d20bf60cb264`+- Verification script SHA-256: `806896603e01be50a9c3e74ac3d87cc1f8ac59699a853f5949b188b40daa0b7a`+- Capability probe source SHA-256: `481dd635efcbee2b614b5ae47defa277a792cb91e3f99e5d0954400a5a787edc`+- Capability probe binary SHA-256: `6e0f26c6c138b4c31379fb659cb5748d98db993d4d19c8db0f0e4a44ed714396`+- `arm64` dylib SHA-256: `515b9d84ab67e86d959282e95c194a5ad8a947261514b947d6f7483c57797b31`+- `arm64e` dylib SHA-256: `62504be341ed74191eab22f19e21d99b2afbe6cc029902c760578ffbbd0588cb`+- Benchmarked `arm64` binary load-command metadata: deployment target `13.0`, macOS SDK `26.4`+- Byte-identical reproduction toolchain: Command Line Tools `26.4.0.0.1774242506`, Apple clang `21.0.0` (`clang-2100.0.123.102`), linker `1266.8`+- A clean 2026-08-10 rebuild from the frozen source using the recovered toolchain reproduced both dylibs and the capability probe byte-for-byte+- A current SDK `26.5` rebuild remains a different, uncertified artifact+- Activation: `DYLD_INSERT_LIBRARIES=<arm64 dylib> LUME_METAL_APPLE_FAMILY_MAX=1009`++The final evidence uses the exact same safe-profile dylib hashes as the 2026-08-09 TinyLlama and+MLX-LM evidence series.diff --git a/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/results.csv b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/results.csvnew file mode 100644index 0000000000..e1c7a9fe20--- /dev/null+++ b/evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4/results.csv@@ -0,0 +1,3 @@+workload,metric,unit,host_baremetal,stock_guest,safe_shim_guest,guest_ratio,shim_to_host_percent+Gemma 4 12B IT QAT Q4_0 (llama.cpp),pp512,tokens/s,517.8775,71.65675,515.763,7.197689,99.591699+Gemma 4 12B IT QAT Q4_0 (llama.cpp),tg128,tokens/s,52.3818,3.41483,49.66695,14.544487,94.817188diff --git a/libs/lume/metal-capability-shim/.gitignore b/libs/lume/metal-capability-shim/.gitignorenew file mode 100644index 0000000000..bded091841--- /dev/null+++ b/libs/lume/metal-capability-shim/.gitignore@@ -0,0 +1,2 @@+/dist/+/.cache/diff --git a/libs/lume/metal-capability-shim/LICENSE b/libs/lume/metal-capability-shim/LICENSEnew file mode 100644index 0000000000..c60b1c2964--- /dev/null+++ b/libs/lume/metal-capability-shim/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Cua AI, Inc.++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/libs/lume/metal-capability-shim/README.md b/libs/lume/metal-capability-shim/README.mdnew file mode 100644index 0000000000..df27f7a0ac--- /dev/null+++ b/libs/lume/metal-capability-shim/README.md@@ -0,0 +1,66 @@+# Lume Metal capability shim++This experimental, process-scoped shim changes selected Metal capability answers inside a macOS virtual machine running on Apple Silicon. GPU commands still use Apple’s paravirtualized graphics path. The shim does not pass a physical device to the guest, patch the host, or change the guest kernel.++The launch artifact is intentionally narrow. It can raise reported support for Apple GPU families through a configured ceiling and raise the threadgroup-memory limit. It does not alter the Common, Mac, or Metal family ranges, and it contains no private feature-profile hook, clock interposition, mesh-draw substitution, ray-tracing override, or pipeline-compilation fallback.++## Build++Build on Apple Silicon with Xcode Command Line Tools installed:++```bash+./Scripts/build.sh+./Scripts/verify.sh+```++The scripts produce `arm64` and `arm64e` dylibs, their `SHA256SUMS`, and a small capability probe under `dist/`. Record the Xcode, SDK, source revision, checkout path, and output hashes because toolchain and build-environment details can change the binary bytes.++The evidence-matched M1 Ultra/Tahoe release binaries use Command Line Tools 26.4. The clean source+revision and exact binary provenance are documented in+[Release/PROVENANCE.md](Release/PROVENANCE.md). To build and verify the source when the matching+toolchain is installed:++```bash+DEVELOPER_DIR=/Library/Developer/CommandLineTools ./Scripts/build.sh+./Scripts/verify.sh --no-build+```++`Scripts/package-release.sh ARTIFACT_DIR RELEASE_DIR` packages a verified binary set, the frozen+source archive, and the committed checksum manifest without overwriting an existing release output.+The release assets are intentionally not committed under `dist/`.++## Run one process++Choose the dylib matching the target process architecture. The tested profile uses Apple-family ceiling `1009` (Apple 9) and 64 KB of reported threadgroup memory:++```bash+DYLD_INSERT_LIBRARIES=/path/to/LumeMetalCapabilities-arm64.dylib \+LUME_METAL_APPLE_FAMILY_MAX=1009 \+./metal-capabilities 1009+```++`LUME_METAL_APPLE_FAMILY_MAX` is required. If it is absent, zero, outside the Apple-family range, or malformed, the library leaves the process unchanged. The other controls are optional:++| Variable | Default | Behavior |+| ----------------------------------------- | --------: | ---------------------------------------------------------------------- |+| `LUME_METAL_MAX_THREADGROUP_MEMORY` | `65536` | Raise reported maximum threadgroup memory to at least this many bytes. |+| `LUME_METAL_RECOMMENDED_WORKING_SET_SIZE` | unchanged | Raise the recommended working-set size only when explicitly set. |++The shim only changes `supportsFamily:` answers in Apple's family range (`1001` through the configured ceiling). It preserves the device's original answers for Common, Mac, Metal, and unknown families. Use these controls only with a tested workload and host/guest combination. A reported capability does not prove that every Metal API using that capability works correctly.++## Remove++Remove `DYLD_INSERT_LIBRARIES` and the `LUME_METAL_*` variables from the workload environment, then restart that workload. The shim makes no persistent system change.++## Compatibility++This code relies on private, version-sensitive Metal implementation details in the macOS guest. Apple may change them in any macOS release. Keep activation scoped to one process, test each host/guest version independently, and treat a missing private class or method as unsupported. Do not broaden the profile by advertising `MTLGPUFamilyMetal3`: MLX-LM uses that answer to select residency sets, which the tested paravirtual device could not create.++## Evidence++- [TinyLlama and MLX-LM validation](../../../evidence/lume-metal-capability-shim/2026-08-09-m1-ultra)+- [Gemma 4 12B validation](../../../evidence/lume-metal-capability-shim/2026-08-10-m1-ultra-gemma4)++## License++MIT. See [LICENSE](LICENSE).diff --git a/libs/lume/metal-capability-shim/Release/PROVENANCE.md b/libs/lume/metal-capability-shim/Release/PROVENANCE.mdnew file mode 100644index 0000000000..ec4f041696--- /dev/null+++ b/libs/lume/metal-capability-shim/Release/PROVENANCE.md@@ -0,0 +1,45 @@+# Release artifact provenance++This manifest describes the locally verified release candidate. It does not record or authorize a+published release.++## Source++- Frozen source revision: `d95545418f4789b5fc9ae13b8614c920071f11b5`+- Source file SHA-256: `e1371b1e579bca895e6b3a2b581b9f328203d9786bf809912a4a5d1672010cce`+- Evidence build source revision: `5336ee9b61f35ffa058c746af237cb334e58bab9`+- Evidence build source file SHA-256: `a0d055caa64afe60d1139ded329d4062f271ab6f1a7f24e6f5738a6f3da4fd40`+- Build script SHA-256 at the frozen revision: `f60b741bca2005d22f4af5f1398614e4f5aa1d49171cc73cd5d1d20bf60cb264`+- Probe source SHA-256: `481dd635efcbee2b614b5ae47defa277a792cb91e3f99e5d0954400a5a787edc`+- Source archive: `git archive --format=tar.gz --prefix=cua-d9554541/ d95545418f4789b5fc9ae13b8614c920071f11b5 libs/lume/metal-capability-shim`++The clean source revision carries the same executable statements as the evidence build used by the+M1 Ultra/Tahoe TinyLlama, MLX-LM, and Gemma 4 runs. The packaged binaries retain the exact+evidence-matched hashes recorded below.++## Toolchain and build++- Command Line Tools package: `com.apple.pkg.CLTools_Executables` version `26.4.0.0.1774242506`+- Compiler: Apple clang `21.0.0` (`clang-2100.0.123.102`)+- SDK: macOS `26.4`+- Deployment target: macOS `13.0`+- Linker recorded by `LC_BUILD_VERSION`: `1266.8`+- Build command: `DEVELOPER_DIR=/Library/Developer/CommandLineTools ./Scripts/build.sh <empty-output-directory>`++On 2026-08-10, two independently retained local artifact sets from the original 2026-08-09+certification matched the dylib hashes. The release package script creates the clean source archive+from the frozen Git object and rejects any binary or archive input that does not match+[SHA256SUMS](SHA256SUMS).++## Binary inspection++- `LumeMetalCapabilities-arm64.dylib`: thin `arm64`, 69,456 bytes, ad-hoc signed+- `LumeMetalCapabilities-arm64e.dylib`: thin `arm64e`, 69,456 bytes, ad-hoc signed+- Install name: `@rpath/LumeMetalCapabilities.dylib`+- Linkage: Foundation, Metal, Objective-C runtime, CoreFoundation, and libSystem+- Both dylibs record macOS SDK `26.4` and minimum macOS `13.0`+- The verification script rejects the research timing, mesh, broad-family, argument-layout, and+ pipeline-compatibility strings and verifies architecture, signatures, and checksums.++The dylibs are ad-hoc signed. They are not Developer ID signed or notarized, and this provenance+record must not be used to imply either property.diff --git a/libs/lume/metal-capability-shim/Release/SHA256SUMS b/libs/lume/metal-capability-shim/Release/SHA256SUMSnew file mode 100644index 0000000000..c59fc2fb71--- /dev/null+++ b/libs/lume/metal-capability-shim/Release/SHA256SUMS@@ -0,0 +1,4 @@+515b9d84ab67e86d959282e95c194a5ad8a947261514b947d6f7483c57797b31 LumeMetalCapabilities-arm64.dylib+62504be341ed74191eab22f19e21d99b2afbe6cc029902c760578ffbbd0588cb LumeMetalCapabilities-arm64e.dylib+6e0f26c6c138b4c31379fb659cb5748d98db993d4d19c8db0f0e4a44ed714396 metal-capabilities+a444c60d6f64afa7340c229de3784fc0e26e62edcad8328edaadf0f5053a8853 LumeMetalCapabilities-source-d9554541.tar.gzdiff --git a/libs/lume/metal-capability-shim/Scripts/build.sh b/libs/lume/metal-capability-shim/Scripts/build.shnew file mode 100755index 0000000000..5836b4312c--- /dev/null+++ b/libs/lume/metal-capability-shim/Scripts/build.sh@@ -0,0 +1,60 @@+#!/bin/sh+set -eu++SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+PROJECT_DIR=$(dirname "$SCRIPT_DIR")+OUTPUT_DIR=${1:-"$PROJECT_DIR/dist"}+SOURCE="$PROJECT_DIR/Sources/LumeMetalCapabilities.m"+PROBE_SOURCE="$PROJECT_DIR/Tests/metal-capabilities.m"++mkdir -p "$OUTPUT_DIR"++build_dylib() {+ architecture=$1+ output=$2++ xcrun clang \+ -arch "$architecture" \+ -O3 \+ -Wall \+ -Wextra \+ -Werror \+ -fobjc-arc \+ -fblocks \+ -fvisibility=hidden \+ -dynamiclib \+ -install_name @rpath/LumeMetalCapabilities.dylib \+ -mmacosx-version-min=13.0 \+ -framework Foundation \+ -framework Metal \+ "$SOURCE" \+ -o "$output"++ codesign --force --sign - "$output"+}++build_dylib arm64 "$OUTPUT_DIR/LumeMetalCapabilities-arm64.dylib"+build_dylib arm64e "$OUTPUT_DIR/LumeMetalCapabilities-arm64e.dylib"++xcrun clang \+ -arch arm64 \+ -O2 \+ -Wall \+ -Wextra \+ -Werror \+ -fobjc-arc \+ -framework Foundation \+ -framework Metal \+ "$PROBE_SOURCE" \+ -o "$OUTPUT_DIR/metal-capabilities"++(+ cd "$OUTPUT_DIR"+ shasum -a 256 \+ LumeMetalCapabilities-arm64.dylib \+ LumeMetalCapabilities-arm64e.dylib \+ metal-capabilities \+ > SHA256SUMS+)++printf 'Built artifacts in %s\n' "$OUTPUT_DIR"diff --git a/libs/lume/metal-capability-shim/Scripts/package-release.sh b/libs/lume/metal-capability-shim/Scripts/package-release.shnew file mode 100755index 0000000000..7e0e6b43cc--- /dev/null+++ b/libs/lume/metal-capability-shim/Scripts/package-release.sh@@ -0,0 +1,57 @@+#!/bin/sh+set -eu++SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+PROJECT_DIR=$(dirname "$SCRIPT_DIR")+REPOSITORY_ROOT=$(git -C "$PROJECT_DIR" rev-parse --show-toplevel)+SOURCE_REVISION=d95545418f4789b5fc9ae13b8614c920071f11b5+SOURCE_ARCHIVE=LumeMetalCapabilities-source-d9554541.tar.gz++if [ "$#" -ne 2 ]; then+ echo "usage: $0 ARTIFACT_DIR RELEASE_DIR" >&2+ exit 64+fi++ARTIFACT_DIR=$1+RELEASE_DIR=$2++for artifact in \+ LumeMetalCapabilities-arm64.dylib \+ LumeMetalCapabilities-arm64e.dylib \+ metal-capabilities; do+ if [ ! -f "$ARTIFACT_DIR/$artifact" ]; then+ echo "missing artifact: $ARTIFACT_DIR/$artifact" >&2+ exit 1+ fi+done++mkdir -p "$RELEASE_DIR"+for output in \+ LumeMetalCapabilities-arm64.dylib \+ LumeMetalCapabilities-arm64e.dylib \+ metal-capabilities \+ "$SOURCE_ARCHIVE" \+ PROVENANCE.md \+ SHA256SUMS; do+ if [ -e "$RELEASE_DIR/$output" ]; then+ echo "refusing to overwrite release output: $RELEASE_DIR/$output" >&2+ exit 1+ fi+done++cp "$ARTIFACT_DIR/LumeMetalCapabilities-arm64.dylib" "$RELEASE_DIR/"+cp "$ARTIFACT_DIR/LumeMetalCapabilities-arm64e.dylib" "$RELEASE_DIR/"+cp "$ARTIFACT_DIR/metal-capabilities" "$RELEASE_DIR/"++git -C "$REPOSITORY_ROOT" archive \+ --format=tar.gz \+ --prefix=cua-d9554541/ \+ --output="$RELEASE_DIR/$SOURCE_ARCHIVE" \+ "$SOURCE_REVISION" \+ libs/lume/metal-capability-shim++cp "$PROJECT_DIR/Release/SHA256SUMS" "$RELEASE_DIR/SHA256SUMS"+cp "$PROJECT_DIR/Release/PROVENANCE.md" "$RELEASE_DIR/PROVENANCE.md"+"$SCRIPT_DIR/verify.sh" --no-build "$RELEASE_DIR"++echo "Packaged verified release assets in $RELEASE_DIR"diff --git a/libs/lume/metal-capability-shim/Scripts/verify.sh b/libs/lume/metal-capability-shim/Scripts/verify.shnew file mode 100755index 0000000000..a5f22abef2--- /dev/null+++ b/libs/lume/metal-capability-shim/Scripts/verify.sh@@ -0,0 +1,54 @@+#!/bin/sh+set -eu++SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+PROJECT_DIR=$(dirname "$SCRIPT_DIR")++BUILD_ARTIFACTS=1+if [ "${1:-}" = "--no-build" ]; then+ BUILD_ARTIFACTS=0+ shift+fi++OUTPUT_DIR=${1:-"$PROJECT_DIR/dist"}++if [ "$BUILD_ARTIFACTS" -eq 1 ]; then+ "$SCRIPT_DIR/build.sh" "$OUTPUT_DIR"+fi++lipo "$OUTPUT_DIR/LumeMetalCapabilities-arm64.dylib" -verify_arch arm64+lipo "$OUTPUT_DIR/LumeMetalCapabilities-arm64e.dylib" -verify_arch arm64e+lipo "$OUTPUT_DIR/metal-capabilities" -verify_arch arm64+codesign --verify --strict "$OUTPUT_DIR/LumeMetalCapabilities-arm64.dylib"+codesign --verify --strict "$OUTPUT_DIR/LumeMetalCapabilities-arm64e.dylib"++if strings "$OUTPUT_DIR/LumeMetalCapabilities-arm64.dylib" | grep -Eq \+ 'GPU_HOOK_TIME_SCALE|mach_absolute_time|clock_gettime|gettimeofday|MESH_FALLBACK|IGNORE_ARGTYPE|SYNC_COMPUTE'; then+ echo "unexpected research-only behavior found in arm64 artifact" >&2+ exit 1+fi++if strings "$OUTPUT_DIR/LumeMetalCapabilities-arm64e.dylib" | grep -Eq \+ 'GPU_HOOK_TIME_SCALE|mach_absolute_time|clock_gettime|gettimeofday|MESH_FALLBACK|IGNORE_ARGTYPE|SYNC_COMPUTE'; then+ echo "unexpected research-only behavior found in arm64e artifact" >&2+ exit 1+fi++if strings "$OUTPUT_DIR/LumeMetalCapabilities-arm64.dylib" | grep -Eq \+ 'LUME_METAL_FEATURE_PROFILE|featureProfile|LUME_METAL_FAMILY_MAX'; then+ echo "unsafe broad capability behavior found in arm64 artifact" >&2+ exit 1+fi++if strings "$OUTPUT_DIR/LumeMetalCapabilities-arm64e.dylib" | grep -Eq \+ 'LUME_METAL_FEATURE_PROFILE|featureProfile|LUME_METAL_FAMILY_MAX'; then+ echo "unsafe broad capability behavior found in arm64e artifact" >&2+ exit 1+fi++(+ cd "$OUTPUT_DIR"+ shasum -a 256 -c SHA256SUMS+)++echo "artifact verification passed"diff --git a/libs/lume/metal-capability-shim/Sources/LumeMetalCapabilities.m b/libs/lume/metal-capability-shim/Sources/LumeMetalCapabilities.mnew file mode 100644index 0000000000..bad2f15b78--- /dev/null+++ b/libs/lume/metal-capability-shim/Sources/LumeMetalCapabilities.m@@ -0,0 +1,206 @@+// Copyright 2026 Cua AI, Inc.+++// SPDX-License-Identifier: MIT++#import <Foundation/Foundation.h>+#import <Metal/Metal.h>+#import <objc/runtime.h>++#include <errno.h>+#include <stdlib.h>++typedef unsigned long long LumeU64;++typedef struct {+ BOOL enabled;+ NSUInteger appleFamilyMax;+ NSUInteger maxThreadgroupMemory;+ BOOL hasRecommendedWorkingSetSize;+ NSUInteger recommendedWorkingSetSize;+} LumeMetalConfiguration;++static LumeMetalConfiguration gConfiguration = {0};+static IMP gOriginalInitGPUFamilySupport = NULL;+static IMP gOriginalMaxThreadgroupMemoryLength = NULL;+static IMP gOriginalRecommendedMaxWorkingSetSize = NULL;+static IMP gOriginalSupportsFamily = NULL;+static BOOL gDeviceHooksInstalled = NO;++static BOOL parseUnsignedEnvironmentValue(const char *name, LumeU64 *value) {+ const char *rawValue = getenv(name);+ if (!rawValue || !*rawValue) return NO;++ errno = 0;+ char *end = NULL;+ unsigned long long parsed = strtoull(rawValue, &end, 0);+ if (errno != 0 || end == rawValue || !end || *end != '\0') return NO;++ *value = parsed;+ return YES;+}++static BOOL loadConfiguration(void) {+ LumeU64 appleFamilyMax = 0;+ if (!parseUnsignedEnvironmentValue(+ "LUME_METAL_APPLE_FAMILY_MAX",+ &appleFamilyMax+ ) || appleFamilyMax < 1001 || appleFamilyMax >= 2000) {+ return NO;+ }++ LumeU64 maxThreadgroupMemory = 65536;+ const char *rawThreadgroupMemory = getenv("LUME_METAL_MAX_THREADGROUP_MEMORY");+ if (rawThreadgroupMemory && *rawThreadgroupMemory &&+ !parseUnsignedEnvironmentValue("LUME_METAL_MAX_THREADGROUP_MEMORY", &maxThreadgroupMemory)) {+ return NO;+ }++ LumeU64 recommendedWorkingSetSize = 0;+ const char *rawWorkingSetSize = getenv("LUME_METAL_RECOMMENDED_WORKING_SET_SIZE");+ BOOL hasRecommendedWorkingSetSize = rawWorkingSetSize && *rawWorkingSetSize;+ if (hasRecommendedWorkingSetSize &&+ !parseUnsignedEnvironmentValue(+ "LUME_METAL_RECOMMENDED_WORKING_SET_SIZE",+ &recommendedWorkingSetSize+ )) {+ return NO;+ }++ gConfiguration.enabled = YES;+ gConfiguration.appleFamilyMax = (NSUInteger)appleFamilyMax;+ gConfiguration.maxThreadgroupMemory = (NSUInteger)maxThreadgroupMemory;+ gConfiguration.hasRecommendedWorkingSetSize = hasRecommendedWorkingSetSize;+ gConfiguration.recommendedWorkingSetSize = (NSUInteger)recommendedWorkingSetSize;+ return YES;+}++static NSUInteger hookMaxThreadgroupMemoryLength(id self, SEL selector) {+ NSUInteger original = gOriginalMaxThreadgroupMemoryLength+ ? ((NSUInteger(*)(id, SEL))(void *)gOriginalMaxThreadgroupMemoryLength)(self, selector)+ : 0;+ return original < gConfiguration.maxThreadgroupMemory+ ? gConfiguration.maxThreadgroupMemory+ : original;+}++static NSUInteger hookRecommendedMaxWorkingSetSize(id self, SEL selector) {+ NSUInteger original = gOriginalRecommendedMaxWorkingSetSize+ ? ((NSUInteger(*)(id, SEL))(void *)gOriginalRecommendedMaxWorkingSetSize)(self, selector)+ : 0;+ return original < gConfiguration.recommendedWorkingSetSize+ ? gConfiguration.recommendedWorkingSetSize+ : original;+}++static BOOL hookSupportsFamily(id self, SEL selector, NSUInteger family) {+ BOOL original = gOriginalSupportsFamily+ ? ((BOOL(*)(id, SEL, NSUInteger))(void *)gOriginalSupportsFamily)(self, selector, family)+ : NO;+ BOOL isConfiguredAppleFamily = family >= 1001 &&+ family <= gConfiguration.appleFamilyMax;+ return original || isConfiguredAppleFamily;+}++static BOOL replaceMethod(+ Class deviceClass,+ NSString *selectorName,+ IMP replacement,+ IMP *original+) {+ SEL selector = NSSelectorFromString(selectorName);+ Method method = class_getInstanceMethod(deviceClass, selector);+ if (!method) return NO;++ *original = method_setImplementation(method, replacement);+ return *original != NULL;+}++static void installDeviceHooks(id device) {+ @synchronized([device class]) {+ if (gDeviceHooksInstalled) return;++ Class deviceClass = [device class];+ Method maxThreadgroupMemory = class_getInstanceMethod(+ deviceClass,+ NSSelectorFromString(@"maxThreadgroupMemoryLength")+ );+ Method supportsFamily = class_getInstanceMethod(+ deviceClass,+ NSSelectorFromString(@"supportsFamily:")+ );+ Method recommendedWorkingSetSize = gConfiguration.hasRecommendedWorkingSetSize+ ? class_getInstanceMethod(+ deviceClass,+ NSSelectorFromString(@"recommendedMaxWorkingSetSize")+ )+ : NULL;++ if (!maxThreadgroupMemory || !supportsFamily ||+ (gConfiguration.hasRecommendedWorkingSetSize && !recommendedWorkingSetSize)) {+ NSLog(@"[LumeMetalCapabilities] Required device methods are unavailable; leaving stock capabilities unchanged");+ return;+ }++ BOOL installed = replaceMethod(+ deviceClass,+ @"maxThreadgroupMemoryLength",+ (IMP)hookMaxThreadgroupMemoryLength,+ &gOriginalMaxThreadgroupMemoryLength+ );+ installed = installed && replaceMethod(+ deviceClass,+ @"supportsFamily:",+ (IMP)hookSupportsFamily,+ &gOriginalSupportsFamily+ );++ if (installed && gConfiguration.hasRecommendedWorkingSetSize) {+ installed = replaceMethod(+ deviceClass,+ @"recommendedMaxWorkingSetSize",+ (IMP)hookRecommendedMaxWorkingSetSize,+ &gOriginalRecommendedMaxWorkingSetSize+ );+ }++ if (!installed) {+ NSLog(@"[LumeMetalCapabilities] Capability hook installation was incomplete");+ return;+ }++ gDeviceHooksInstalled = YES;+ NSLog(+ @"[LumeMetalCapabilities] Enabled for %@ (appleFamilyMax=%llu maxThreadgroupMemory=%llu)",+ [NSProcessInfo processInfo].processName,+ (LumeU64)gConfiguration.appleFamilyMax,+ (LumeU64)gConfiguration.maxThreadgroupMemory+ );+ }+}++static void hookInitGPUFamilySupport(id self, SEL selector) {+ installDeviceHooks(self);+ ((void(*)(id, SEL))(void *)gOriginalInitGPUFamilySupport)(self, selector);+}++__attribute__((constructor))+static void initializeLumeMetalCapabilities(void) {+ @autoreleasepool {+ if (!loadConfiguration()) return;++ Class deviceClass = NSClassFromString(@"_MTLDevice");+ if (!deviceClass) return;++ Method method = class_getInstanceMethod(+ deviceClass,+ NSSelectorFromString(@"initGPUFamilySupport")+ );+ if (!method) return;++ gOriginalInitGPUFamilySupport = method_setImplementation(+ method,+ (IMP)hookInitGPUFamilySupport+ );+ }+}diff --git a/libs/lume/metal-capability-shim/Tests/benchmark-mlx-lm.py b/libs/lume/metal-capability-shim/Tests/benchmark-mlx-lm.pynew file mode 100644index 0000000000..12a30c6fb8--- /dev/null+++ b/libs/lume/metal-capability-shim/Tests/benchmark-mlx-lm.py@@ -0,0 +1,150 @@+#!/usr/bin/env python3+"""Run a repeatable MLX-LM prefill and generation throughput benchmark."""++from __future__ import annotations++import argparse+import json+import platform+import statistics+import sys+import time+from importlib.metadata import version+from pathlib import Path++import mlx.core as mx+from mlx_lm import load, stream_generate+++PROMPT_SEED = (+ "Apple Silicon virtual machines expose a paravirtualized Metal device. "+ "Applications query its capabilities before choosing compute kernels. "+ "This benchmark repeats a fixed passage to measure prompt processing and "+ "token generation with identical model weights and prompt tokens. "+)+++def parse_args() -> argparse.Namespace:+ parser = argparse.ArgumentParser()+ parser.add_argument("--model", required=True, help="Local MLX model directory")+ parser.add_argument("--model-id", required=True, help="Published model identifier")+ parser.add_argument("--model-revision", required=True, help="Pinned model revision")+ parser.add_argument("--prompt-tokens", type=int, default=512)+ parser.add_argument("--generation-tokens", type=int, default=128)+ parser.add_argument("--repeats", type=int, default=10)+ parser.add_argument("--warmup-prompt-tokens", type=int, default=64)+ parser.add_argument("--warmup-generation-tokens", type=int, default=16)+ parser.add_argument("--seed", type=int, default=42)+ parser.add_argument("--output", type=Path, required=True)+ return parser.parse_args()+++def fixed_prompt(tokenizer, count: int) -> list[int]:+ text = PROMPT_SEED+ while len(tokenizer.encode(text, add_special_tokens=True)) < count:+ text += PROMPT_SEED+ return list(tokenizer.encode(text, add_special_tokens=True)[:count])+++def run_once(model, tokenizer, prompt: list[int], max_tokens: int, seed: int) -> dict:+ mx.random.seed(seed)+ mx.clear_cache()+ if hasattr(mx, "reset_peak_memory"):+ mx.reset_peak_memory()++ started = time.perf_counter()+ response = None+ for response in stream_generate(+ model,+ tokenizer,+ prompt,+ max_tokens=max_tokens,+ ):+ pass+ elapsed = time.perf_counter() - started+ if response is None:+ raise RuntimeError("MLX-LM returned no generation response")++ return {+ "prompt_tokens": int(response.prompt_tokens),+ "prompt_tps": float(response.prompt_tps),+ "generation_tokens": int(response.generation_tokens),+ "generation_tps": float(response.generation_tps),+ "peak_memory_gb": float(response.peak_memory),+ "finish_reason": response.finish_reason,+ "wall_seconds": elapsed,+ }+++def main() -> None:+ args = parse_args()+ model, tokenizer = load(args.model)++ # Match llama-bench semantics by measuring the requested token count even if+ # the generated stream happens to contain the model's end-of-sequence token.+ tokenizer._eos_token_ids = set()++ prompt = fixed_prompt(tokenizer, args.prompt_tokens)+ warmup_prompt = prompt[: args.warmup_prompt_tokens]+ warmup = run_once(+ model,+ tokenizer,+ warmup_prompt,+ args.warmup_generation_tokens,+ args.seed,+ )++ samples = [+ run_once(+ model,+ tokenizer,+ prompt,+ args.generation_tokens,+ args.seed + repeat,+ )+ for repeat in range(args.repeats)+ ]++ result = {+ "schema_version": 1,+ "runtime": {+ "python": platform.python_version(),+ "mlx": version("mlx"),+ "mlx_lm": version("mlx-lm"),+ "platform": platform.platform(),+ },+ "model": {+ "id": args.model_id,+ "revision": args.model_revision,+ "path": str(Path(args.model).resolve()),+ },+ "configuration": {+ "prompt_tokens": args.prompt_tokens,+ "generation_tokens": args.generation_tokens,+ "repeats": args.repeats,+ "warmup_prompt_tokens": args.warmup_prompt_tokens,+ "warmup_generation_tokens": args.warmup_generation_tokens,+ "seed": args.seed,+ "eos_stopping": False,+ },+ "warmup": warmup,+ "samples": samples,+ "median": {+ "prompt_tps": statistics.median(s["prompt_tps"] for s in samples),+ "generation_tps": statistics.median(+ s["generation_tps"] for s in samples+ ),+ "peak_memory_gb": statistics.median(+ s["peak_memory_gb"] for s in samples+ ),+ },+ }++ args.output.parent.mkdir(parents=True, exist_ok=True)+ args.output.write_text(json.dumps(result, indent=2) + "\n")+ json.dump(result, sys.stdout, indent=2)+ sys.stdout.write("\n")+++if __name__ == "__main__":+ main()diff --git a/libs/lume/metal-capability-shim/Tests/metal-capabilities.m b/libs/lume/metal-capability-shim/Tests/metal-capabilities.mnew file mode 100644index 0000000000..ad1289093d--- /dev/null+++ b/libs/lume/metal-capability-shim/Tests/metal-capabilities.m@@ -0,0 +1,42 @@+#import <Foundation/Foundation.h>+#import <Metal/Metal.h>++#include <errno.h>+#include <stdlib.h>++static BOOL parseFamily(const char *raw, NSUInteger *family) {+ errno = 0;+ char *end = NULL;+ unsigned long long parsed = strtoull(raw, &end, 0);+ if (errno != 0 || end == raw || !end || *end != '\0') return NO;+ *family = (NSUInteger)parsed;+ return YES;+}++int main(int argc, const char *argv[]) {+ @autoreleasepool {+ NSUInteger family = 1009;+ if (argc > 1 && !parseFamily(argv[1], &family)) {+ fprintf(stderr, "invalid family: %s\n", argv[1]);+ return 2;+ }++ id<MTLDevice> device = MTLCreateSystemDefaultDevice();+ if (!device) {+ fprintf(stderr, "Metal device unavailable\n");+ return 1;+ }++ printf("device=%s\n", device.name.UTF8String);+ printf("family=%llu\n", (unsigned long long)family);+ printf(+ "supports_family=%s\n",+ [device supportsFamily:(MTLGPUFamily)family] ? "true" : "false"+ );+ printf(+ "max_threadgroup_memory=%llu\n",+ (unsigned long long)device.maxThreadgroupMemoryLength+ );+ }+ return 0;+}