-
Notifications
You must be signed in to change notification settings - Fork 19
Display TensorRT-LLM AgentX server metrics #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bc2ba7b
feat(agentx): display TensorRT-LLM server metrics
cquil11 1e48786
fix(agentx): handle AIPerf-normalized TRT metric names
cquil11 10cdc42
fix(agentx): derive TRT prompt throughput from prefill histogram
cquil11 c3acc10
Merge branch 'master' into agent/capture-trtllm-server-metrics
cquil11 80f9aec
Fix staged metric-series refreshes
cquil11 d44429d
Label TRTLLM cache hits as combined
cquil11 2fdb175
fix(agentic): wrap point-detail chart legends instead of overlapping
cquil11 22337f6
feat(ingest): target named Neon branches
cquil11 8260849
fix(ingest): tolerate preview cache invalidation failures
cquil11 f030da6
fix(metrics): preserve TRT worker ranks and verify child database tar…
cquil11 dc97343
Merge remote-tracking branch 'origin/master' into agent/capture-trtll…
cquil11 0896009
Add run-scoped server metrics recomputation
cquil11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Recompute Agentic Metrics | ||
| run-name: Recompute production metrics for run ${{ inputs.run-id }} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| run-id: | ||
| description: Already-ingested GitHub benchmark run to recompute in production | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ inputs.run-id }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| recompute: | ||
| name: Recompute stored server metrics | ||
| if: github.ref == 'refs/heads/master' | ||
| runs-on: blacksmith-16vcpu-ubuntu-2404 | ||
| timeout-minutes: 90 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | ||
| with: | ||
| bun-version-file: package.json | ||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
| env: | ||
| CYPRESS_INSTALL_BINARY: '0' | ||
| - name: Recompute chart series and aggregate statistics | ||
| env: | ||
| DATABASE_WRITE_URL: ${{ secrets.DATABASE_WRITE_URL }} | ||
| RUN_ID: ${{ inputs.run-id }} | ||
| run: | | ||
| bun run --cwd packages/db db:backfill-chart-series --run-id "$RUN_ID" --force --yes | ||
| bun run --cwd packages/db db:backfill-aggregate-stats --run-id "$RUN_ID" --force --yes | ||
| - name: Invalidate production cache | ||
| env: | ||
| INVALIDATE_SECRET: ${{ secrets.VERCEL_INVALIDATE_SECRET }} | ||
| run: bun run admin:cache:invalidate https://inferencex.semianalysis.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
packages/app/src/components/inference/agentic-point/chart-legend.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { | ||
| LEGEND_ITEM_GAP, | ||
| LEGEND_ROW_HEIGHT, | ||
| LEGEND_TEXT_OFFSET, | ||
| estimateTextWidth, | ||
| layoutChartLegend, | ||
| } from './chart-legend'; | ||
|
|
||
| // Inline render of the point-detail charts: 720 viewBox units wide with the | ||
| // shared 60/16 left/right axis padding. | ||
| const INLINE_INNER_WIDTH = 720 - 60 - 16; | ||
|
|
||
| /** Right edge of the item at `index`, i.e. where its text stops. */ | ||
| const itemRight = (labels: readonly string[], index: number, width: number): number => { | ||
| const { items } = layoutChartLegend(labels, width); | ||
| return items[index]!.x + LEGEND_TEXT_OFFSET + estimateTextWidth(labels[index]!); | ||
| }; | ||
|
|
||
| describe('estimateTextWidth', () => { | ||
| it('grows with the number of characters', () => { | ||
| expect(estimateTextWidth('decode')).toBeGreaterThan(estimateTextWidth('dec')); | ||
| }); | ||
|
|
||
| it('counts CJK characters as roughly one em each', () => { | ||
| // Four fullwidth characters at font size 11. | ||
| expect(estimateTextWidth('芯片缓存')).toBeCloseTo(44, 5); | ||
| }); | ||
|
|
||
| it('charges more for wide characters than narrow ones', () => { | ||
| expect(estimateTextWidth('mmmm')).toBeGreaterThan(estimateTextWidth('llll')); | ||
| }); | ||
|
|
||
| it('returns zero for an empty label', () => { | ||
| expect(estimateTextWidth('')).toBe(0); | ||
| }); | ||
|
|
||
| it('scales linearly with font size', () => { | ||
| expect(estimateTextWidth('decode', 22)).toBeCloseTo(estimateTextWidth('decode', 11) * 2, 5); | ||
| }); | ||
| }); | ||
|
|
||
| describe('layoutChartLegend', () => { | ||
| it('keeps a short legend on one row and reserves no extra height', () => { | ||
| const layout = layoutChartLegend(['Input', 'Decode'], INLINE_INNER_WIDTH); | ||
| expect(layout.rows).toBe(1); | ||
| expect(layout.extraHeight).toBe(0); | ||
| expect(layout.items.map((i) => i.row)).toEqual([0, 0]); | ||
| }); | ||
|
|
||
| it('lays same-row items out left to right without overlapping', () => { | ||
| const labels = ['Input', 'Decode']; | ||
| const { items } = layoutChartLegend(labels, INLINE_INNER_WIDTH); | ||
| expect(items[0]!.x).toBe(0); | ||
| expect(items[1]!.x).toBe(LEGEND_TEXT_OFFSET + estimateTextWidth(labels[0]!) + LEGEND_ITEM_GAP); | ||
| expect(items[1]!.x).toBeGreaterThanOrEqual(itemRight(labels, 0, INLINE_INNER_WIDTH)); | ||
| }); | ||
|
|
||
| it('wraps the eleven-series KV-cache legend instead of overprinting it', () => { | ||
| // The regression from the inline KV-cache chart: eleven per-engine labels | ||
| // in ~644 units used to get 58 units each and collide. | ||
| const labels = [ | ||
| 'prefill (500e)', | ||
| 'prefill (501a)', | ||
| 'prefill (501e)', | ||
| 'decode (5021)', | ||
| 'decode (5023)', | ||
| 'decode (5025)', | ||
| 'decode (5027)', | ||
| 'Chip HBM (avg n=50)', | ||
| 'DRAM', | ||
| 'CPU offload pool (avg n=50)', | ||
| 'Avg', | ||
| ]; | ||
| const layout = layoutChartLegend(labels, INLINE_INNER_WIDTH); | ||
|
|
||
| expect(layout.rows).toBeGreaterThan(1); | ||
| expect(layout.extraHeight).toBe((layout.rows - 1) * LEGEND_ROW_HEIGHT); | ||
|
|
||
| for (const [i, label] of labels.entries()) { | ||
| const item = layout.items[i]!; | ||
| const right = item.x + LEGEND_TEXT_OFFSET + estimateTextWidth(label); | ||
| // Every item fits inside the plot width... | ||
| expect(right).toBeLessThanOrEqual(INLINE_INNER_WIDTH); | ||
| // ...and starts clear of its predecessor on the same row. | ||
| const prev = layout.items[i - 1]; | ||
| if (prev && prev.row === item.row) { | ||
| expect(item.x).toBeGreaterThanOrEqual( | ||
| prev.x + LEGEND_TEXT_OFFSET + estimateTextWidth(labels[i - 1]!), | ||
| ); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| it('starts each wrapped row back at the left edge', () => { | ||
| const labels = Array.from({ length: 12 }, (_, i) => `series number ${i}`); | ||
| const layout = layoutChartLegend(labels, INLINE_INNER_WIDTH); | ||
| const firstOfRow = new Map<number, number>(); | ||
| for (const item of layout.items) { | ||
| if (!firstOfRow.has(item.row)) firstOfRow.set(item.row, item.x); | ||
| } | ||
| for (const x of firstOfRow.values()) expect(x).toBe(0); | ||
| }); | ||
|
|
||
| it('wraps sooner for Chinese labels, which are wider per character', () => { | ||
| const en = Array.from({ length: 6 }, () => 'Chip HBM pool'); | ||
| const zh = Array.from({ length: 6 }, () => '芯片 HBM 显存池均值'); | ||
| expect(layoutChartLegend(zh, INLINE_INNER_WIDTH).rows).toBeGreaterThanOrEqual( | ||
| layoutChartLegend(en, INLINE_INNER_WIDTH).rows, | ||
| ); | ||
| }); | ||
|
|
||
| it('needs fewer rows at the expanded width than inline', () => { | ||
| const labels = Array.from({ length: 11 }, (_, i) => `decode engine ${i}`); | ||
| const inline = layoutChartLegend(labels, INLINE_INNER_WIDTH); | ||
| const expanded = layoutChartLegend(labels, 1300 - 60 - 16); | ||
| expect(expanded.rows).toBeLessThan(inline.rows); | ||
| }); | ||
|
|
||
| it('gives a label wider than the row its own row rather than dropping it', () => { | ||
| const layout = layoutChartLegend(['a', 'w'.repeat(300), 'b'], 100); | ||
| expect(layout.items).toHaveLength(3); | ||
| expect(layout.items[1]!.row).toBe(1); | ||
| expect(layout.items[1]!.x).toBe(0); | ||
| expect(layout.items[2]!.row).toBe(2); | ||
| }); | ||
|
|
||
| it('reports a single row for an empty legend', () => { | ||
| const layout = layoutChartLegend([], INLINE_INNER_WIDTH); | ||
| expect(layout.items).toEqual([]); | ||
| expect(layout.rows).toBe(1); | ||
| expect(layout.extraHeight).toBe(0); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.