-
Notifications
You must be signed in to change notification settings - Fork 0
Add m4 and a18 chipsets #1
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
Changes from all commits
beb0159
0362435
9575277
224849e
34fa5d7
f150a60
6ff773e
29a4fc3
0800045
85f693a
562c130
85329d8
9686fac
e933bde
8c5d4c8
310cc84
b915ac7
c697229
66368d8
b2b412a
a7162b4
477f634
9521a76
fcc37f6
0c0da96
f58402a
42dd001
26242fb
3d21c36
1348293
187daed
c920c3b
573b42d
13af7f3
e3b3149
93daba7
b2a5fc2
f80c789
aed40c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Publish package to GitHub Packages | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js & GitHub Packages registry | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18.x' | ||
| registry-url: 'https://npm.pkg.github.com' | ||
|
|
||
| - name: Install, build, & test | ||
| run: | | ||
| npm install --legacy-peer-deps | ||
| npm run build | ||
| npm test | ||
| env: | ||
| NPM_TOKEN: ${{secrets.NPM_TOKEN}} | ||
|
|
||
| - name: Publish to GitHub Packages | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
| NPM_TOKEN: ${{secrets.NPM_TOKEN}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Publish benchmarks to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '0 0 */14 * *' # every 14 days at midnight UTC | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| env: | ||
| BENCHMARKS_URL: https://roll20.github.io/detect-gpu | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18.x' | ||
|
|
||
| - name: Install & build | ||
| run: | | ||
| npm install --legacy-peer-deps | ||
| npm run build | ||
| - name: Update benchmarks | ||
| run: npm run update-benchmarks | ||
|
|
||
| - name: Validate *local* benchmark JSON shape | ||
| run: | | ||
| npx jest test/validate-benchmarks-shape.test.ts \ | ||
| --env=jsdom \ | ||
| --runTestsByPath | ||
| env: | ||
| BENCHMARKS_URL: file://${{ github.workspace }}/benchmarks | ||
|
|
||
| - name: Upload benchmarks as Pages artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: benchmarks | ||
|
|
||
| deploy: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
|
|
||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| package-lock=false | ||
| @roll20:registry=https://npm.pkg.github.com | ||
| //npm.pkg.github.com/:_authToken=${NPM_TOKEN} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,20 +216,23 @@ export const getGPUTier = async ({ | |
| } | ||
|
|
||
| const tokenizedRenderer = tokenizeForLevenshteinDistance(renderer); | ||
| // eslint-disable-next-line prefer-const | ||
| let [gpu, , , , fpsesByPixelCount] = | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where their old code was going wrong where it was incorrectly retrieving the placement of where the fpsesByPixelCount should be - so for now to support both data shapes we just assume its the last entry in the array which seems to be accurate between how it used to look and now - if this ever changes again though our test should pick it up |
||
| // pick the best matching row | ||
| const bestMatch = | ||
| matchCount > 1 | ||
| ? matched | ||
| .map( | ||
| (match) => | ||
| [ | ||
| match, | ||
| getLevenshteinDistance(tokenizedRenderer, match[2]), | ||
| ] as const | ||
| .map((match) => | ||
| [match, getLevenshteinDistance(tokenizedRenderer, match[2])] as const | ||
| ) | ||
| .sort(([, a], [, b]) => a - b)[0][0] | ||
| : matched[0]; | ||
|
|
||
| // gpu name is always at index 0 | ||
| const gpu = bestMatch[0]; | ||
|
|
||
| // fpses array is always the last element | ||
| const fpsesByPixelCount = bestMatch[bestMatch.length - 1] as ModelEntryScreen[]; | ||
|
|
||
| debug?.( | ||
| `${renderer} matched closest to ${gpu} with the following screen sizes`, | ||
| JSON.stringify(fpsesByPixelCount) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /** | ||
| * @jest-environment node | ||
| * | ||
| */ | ||
|
|
||
| import fetch from 'cross-fetch'; | ||
| (global as any).fetch = fetch; | ||
| import fs from 'fs/promises'; | ||
|
|
||
| const BENCHMARKS_URL = process.env.BENCHMARKS_URL || 'https://roll20.github.io/detect-gpu'; | ||
| const TEST_FILE = 'd-apple.json'; | ||
|
|
||
| interface ScreenEntry extends Array<number> { | ||
| 0: number; | ||
| 1: number; | ||
| 2: number; | ||
| } | ||
|
|
||
| describe('Live benchmark data shape', () => { | ||
| let data: unknown; | ||
|
|
||
| beforeAll(async () => { | ||
| const base = BENCHMARKS_URL.replace(/\/$/, ''); | ||
| if (base.startsWith('file://')) { | ||
| const dirPath = base.replace(/^file:\/\//, ''); | ||
| const raw = await fs.readFile(`${dirPath}/${TEST_FILE}`, 'utf8'); | ||
| data = JSON.parse(raw); | ||
| } else { | ||
| const res = await fetch(`${base}/${TEST_FILE}`); | ||
| expect(res.ok).toBe(true); | ||
| data = await res.json(); | ||
| } | ||
| }); | ||
|
|
||
| it('is an array with a version string at index 0', () => { | ||
| expect(Array.isArray(data)).toBe(true); | ||
| expect(typeof (data as any)[0]).toBe('string'); | ||
| }); | ||
|
|
||
| it('each entry has the correct tuple shape', () => { | ||
| const entries = (data as any).slice(1); | ||
| expect(entries.length).toBeGreaterThan(0); | ||
|
|
||
| for (const entry of entries) { | ||
| expect(Array.isArray(entry)).toBe(true); | ||
| expect([4, 5]).toContain(entry.length); | ||
|
|
||
| const screens = entry[entry.length - 1]; | ||
| expect(Array.isArray(screens)).toBe(true); | ||
| expect(screens.length).toBeGreaterThan(0); | ||
|
|
||
| for (const screen of screens) { | ||
| expect(Array.isArray(screen)).toBe(true); | ||
| expect((screen as ScreenEntry).length).toBe(3); | ||
|
|
||
| const [w, h, fps] = screen as ScreenEntry; | ||
| expect(typeof w).toBe('number'); | ||
| expect(typeof h).toBe('number'); | ||
| expect(typeof fps).toBe('number'); | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we run the new test to verify that the json generated from the https://gfxbench.com/result.jsp matches the shape we expect