lagora-cli 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/dist/help.txt +70 -0
- package/dist/lagora.js +342 -0
- package/dist/report-help.txt +5 -0
- package/dist/scripts/agora_playground_harness.py +263 -0
- package/dist/scripts/announce.js +41 -0
- package/dist/scripts/check-kernel-submission.py +90 -0
- package/dist/scripts/chunk-2EAJVB5D.js +100 -0
- package/dist/scripts/chunk-2KTLCUFI.js +29 -0
- package/dist/scripts/chunk-AZ3EEBVD.js +137 -0
- package/dist/scripts/chunk-NBJMYAOA.js +2128 -0
- package/dist/scripts/chunk-NCJMUBTG.js +125 -0
- package/dist/scripts/chunk-QJPQHKIO.js +23 -0
- package/dist/scripts/chunk-RIR5KGHC.js +33 -0
- package/dist/scripts/chunk-TJZVQYBL.js +8 -0
- package/dist/scripts/chunk-UHJXD4TG.js +18 -0
- package/dist/scripts/chunk-UQ6I6VTY.js +117 -0
- package/dist/scripts/cli-auth.js +348 -0
- package/dist/scripts/cli-config-IA7EOSYD.js +7 -0
- package/dist/scripts/install-skill.js +199 -0
- package/dist/scripts/issue-local-client-DZUXZOKY.js +22 -0
- package/dist/scripts/issue-search.js +1823 -0
- package/dist/scripts/issue.js +386 -0
- package/dist/scripts/keycloak-provision.js +986 -0
- package/dist/scripts/legato-fsim-runner.py +126 -0
- package/dist/scripts/legato-lowering-runner.py +156 -0
- package/dist/scripts/legato_runner_annotations.py +235 -0
- package/dist/scripts/legato_runner_env.py +91 -0
- package/dist/scripts/legato_runner_launchers.py +287 -0
- package/dist/scripts/legato_runner_script_wrapper.py +193 -0
- package/dist/scripts/notifications-EU43SIEV.js +624 -0
- package/dist/scripts/playground.js +408 -0
- package/dist/scripts/report-bundle-sync-3U7QTP4Z.js +215 -0
- package/dist/scripts/report.js +104 -0
- package/dist/scripts/resolve-sdk-package-version.py +151 -0
- package/dist/scripts/sdk-runtime-JE6H2PB2.js +992 -0
- package/dist/scripts/sdk-runtime-kubernetes-job-KOWL4ITV.js +479 -0
- package/dist/scripts/sdk-runtime-smoke.py +168 -0
- package/dist/scripts/sdk.js +256 -0
- package/dist/scripts/site-feedback-CAPE5MPX.js +136 -0
- package/dist/scripts/site-feedback-rate-limit-5BU2WSFE.js +86 -0
- package/dist/scripts/site-feedback.js +117 -0
- package/dist/scripts/storage-234FBH54.js +67 -0
- package/dist/scripts/submit-issue.sh +489 -0
- package/dist/scripts/verification-3QCY66QW.js +772 -0
- package/dist/scripts/verify-issue.js +144 -0
- package/dist/skills/legato-agora-cli/SKILL.md +556 -0
- package/dist/skills/legato-agora-cli/agents/openai.yaml +7 -0
- package/dist/skills/legato-agora-cli/reference/kernel-with-golden.py +84 -0
- package/dist/skills/legato-site-feedback/SKILL.md +49 -0
- package/dist/skills/legato-site-feedback/agents/openai.yaml +7 -0
- package/package.json +16 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legato-agora-cli
|
|
3
|
+
description: "Use this skill whenever an agent needs to work with the Legato Dev Agora CLI: search similar issues, report Legato kernel/lowering/fSIM issues, synthesize a minimal repro kernel when needed, fetch or inspect reported issues, download issue artifacts for debugging, run automatic lowering verification, add analysis/solution comments, update issue status, or handle site feedback. Trigger for Legato Agora, lagora, kernel issue report, lowering error reproduction, issue artifact download, site feedback, or language-team debugging workflows."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Legato Agora CLI
|
|
7
|
+
|
|
8
|
+
This skill lets an agent drive the `lagora` CLI end to end for Legato kernel issue workflows: issue search, issue reporting, issue lookup, artifact checkout, automatic lowering reproduction, structured debugging updates, and site feedback handling.
|
|
9
|
+
|
|
10
|
+
Legato Dev Agora exists to automate the interface between Legato language users and language developers. The skill should make requests lightweight for kernel authors while preserving enough structure for language developers to triage, reproduce, resolve, and learn from more feedback.
|
|
11
|
+
|
|
12
|
+
## First Decisions
|
|
13
|
+
|
|
14
|
+
1. Choose the target. Commands run against the deployed board by default, so
|
|
15
|
+
normally you pass nothing:
|
|
16
|
+
- Another deployment, such as a local dev server: `--api-url <url>`, or set `LAGORA_API_URL`.
|
|
17
|
+
- Local or mounted issue store: `--store /path/to/issue-store`.
|
|
18
|
+
2. Confirm the CLI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
lagora help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If `lagora` is not installed but this repo is available, run it from the repo with `./bin/lagora ...` after `npm install`.
|
|
25
|
+
|
|
26
|
+
3. Log in before anything else when the target is the remote board. Every command except `lagora help` refuses to run without a verified login, so check first instead of discovering it through a failed request:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
lagora whoami
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Login
|
|
33
|
+
|
|
34
|
+
`lagora login` opens a browser and completes both the Keycloak sign-in and the activity-profile selection for that browser device. Nothing is typed into the CLI; it receives an opaque token bound to the API origin.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
lagora login
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Tell the user to finish the browser flow, then continue. Related commands:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
lagora whoami # who the saved login belongs to
|
|
44
|
+
lagora tokens # list and revoke this account's CLI tokens
|
|
45
|
+
lagora logout # revoke the token and clear it locally
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If a command fails with either message below, stop and run `lagora login` again rather than retrying or working around it:
|
|
49
|
+
|
|
50
|
+
- `Run \`lagora login --api-url <url>\` first` — no saved login
|
|
51
|
+
- `CLI login expired; run \`lagora login --api-url <url>\` again` — the token was revoked or expired
|
|
52
|
+
|
|
53
|
+
A saved login belongs to one API URL. Pointing `--api-url` at a different host requires logging in to that host; the CLI refuses to reuse the token across origins.
|
|
54
|
+
|
|
55
|
+
Local `--store` workflows need no login, stay name-only, and do not receive server notifications.
|
|
56
|
+
|
|
57
|
+
## Notifications
|
|
58
|
+
|
|
59
|
+
The web board delivers in-app notifications through the authenticated browser session. The CLI is pull-based: it lists unread notifications and marks handled items read through the same server session cookie.
|
|
60
|
+
|
|
61
|
+
At the start of an issue workflow, check unread notifications:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
lagora issue notifications \
|
|
65
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Use notification links to fetch or inspect the referenced issue, then mark handled notifications read:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
lagora issue notifications read \
|
|
72
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
73
|
+
--notification <notification-id>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
After a batch workflow, mark all handled notifications read only when every listed item has actually been handled:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
lagora issue notifications read-all \
|
|
80
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Do not expect notifications for actions performed by the same logged-in user. The board excludes the actor from their own notifications.
|
|
84
|
+
|
|
85
|
+
## Announce A Verified Feature
|
|
86
|
+
|
|
87
|
+
After a user-visible feature has passed its tests and manual QA and its production deployment is confirmed, publish a short site announcement:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
LAGORA_ANNOUNCEMENT_TOKEN="<deployment-secret>" lagora announce create \
|
|
91
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
92
|
+
--title "Playground available" \
|
|
93
|
+
--body "Run a submitted kernel against a prepared SDK from the new Playground." \
|
|
94
|
+
--link /playground
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Do not announce a local-only edit, a failed deployment, or an unverified feature. Never print, commit, or copy the announcement token into logs.
|
|
98
|
+
|
|
99
|
+
## Inspect Or Update The Site's SDK Packages
|
|
100
|
+
|
|
101
|
+
The site builds the Legato/HyperAccel SDK itself and follows upstream on a 12-hour timer. Use this when a Playground run fails on a missing or stale package, or when a new SDK version should be picked up now rather than at the next check.
|
|
102
|
+
|
|
103
|
+
The token comes from **Settings → SDK → CLI access token**, where an admin issues one. Rotating replaces the old token; revoking closes the CLI routes entirely.
|
|
104
|
+
|
|
105
|
+
Read the current state first — this reports whether a prepare is running, and why the last one failed:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
LAGORA_SDK_TOKEN="<deployment-secret>" lagora sdk status \
|
|
109
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
lagora sdk list --api-url ... # prepared versions; --disk adds sizes
|
|
114
|
+
lagora sdk log --api-url ... # full build output of the last prepare
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Trigger an update. This builds the upstream version when it is newer than anything prepared, then prunes all but the newest few:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
LAGORA_SDK_TOKEN="<deployment-secret>" lagora sdk update \
|
|
121
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
122
|
+
--watch
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
A prepare compiles the SDK from source and takes over an hour; `--watch` polls until it settles and exits non-zero on failure. `--force` rebuilds the current version instead of stopping when upstream is already prepared — use it only to recover from a corrupted build, since it discards a working runtime's cache advantage. Never print, commit, or copy the SDK token into logs.
|
|
126
|
+
|
|
127
|
+
## Report A New Issue
|
|
128
|
+
|
|
129
|
+
Use this when the user has a failing kernel, error log, compile/lowering failure, or wants the language team to inspect a reproducible problem.
|
|
130
|
+
|
|
131
|
+
Before creating a new report, search for similar open or resolved issues unless the user explicitly says to skip duplicate checking:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
lagora search \
|
|
135
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
136
|
+
--query "CORE_IR lowering cgdma Xfer=0 receive_type" \
|
|
137
|
+
--limit 5
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
For a local issue-store:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
lagora search --store /path/to/issue-store --query "lowering verifier request_load" --limit 5
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If a likely duplicate exists, fetch or comment on the existing issue instead of filing a new one. If the match is only related, mention the related issue in the new report body.
|
|
147
|
+
|
|
148
|
+
### Test a working-tree kernel in Playground
|
|
149
|
+
|
|
150
|
+
When the user wants to test current code before deciding whether it is an
|
|
151
|
+
issue, use the Playground CLI instead of `lagora report`:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
lagora playground runtimes
|
|
155
|
+
lagora playground run --kernel /path/to/kernel.py --sdk-name <prepared-runtime-name>
|
|
156
|
+
lagora playground status --run <run-id>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Use `--legato <version> --sdk <version>` instead of `--sdk-name` when the user
|
|
160
|
+
names a published runtime pair. Use `--mode fsim` only when a value run is
|
|
161
|
+
required. Preserve the returned run id.
|
|
162
|
+
|
|
163
|
+
If the run demonstrates a reportable problem, submit the exact tested source
|
|
164
|
+
and worker log without rebuilding the bundle by hand:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
lagora playground report \
|
|
168
|
+
--run <run-id> \
|
|
169
|
+
--title "<short symptom>" \
|
|
170
|
+
--description "<what the run demonstrated>" \
|
|
171
|
+
--tags lowering,regression
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This keeps the issue linked to the run by source hash. Do not edit the kernel
|
|
175
|
+
between `run` and `report`; start another run for edited source.
|
|
176
|
+
|
|
177
|
+
Required inputs:
|
|
178
|
+
|
|
179
|
+
- kernel file path
|
|
180
|
+
- short title
|
|
181
|
+
- reporter/author name
|
|
182
|
+
|
|
183
|
+
Useful optional inputs:
|
|
184
|
+
|
|
185
|
+
- error log path
|
|
186
|
+
- tags, comma-separated
|
|
187
|
+
- SDK root and Python for automatic lowering
|
|
188
|
+
- kernel function name when the module has multiple `@legato.compile` functions
|
|
189
|
+
|
|
190
|
+
Write a concise report body to `/tmp/legato-agora-report.md`. Use Korean by default, but preserve exact command names, pass names, identifiers, and error messages in their original form.
|
|
191
|
+
|
|
192
|
+
When the user already supplied the failing kernel, preserve it as evidence even
|
|
193
|
+
if it has its own launcher. Do not rewrite away the bug just to satisfy the
|
|
194
|
+
Playground harness. The strict harness contract below applies to kernels this
|
|
195
|
+
skill generates or adapts specifically for automated Playground verification.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
lagora report \
|
|
199
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
200
|
+
--kernel /path/to/kernel.py \
|
|
201
|
+
--log /path/to/error.log \
|
|
202
|
+
--title "lowering failure in matmul kernel" \
|
|
203
|
+
--reporter "agent" \
|
|
204
|
+
--description-file /tmp/legato-agora-report.md \
|
|
205
|
+
--tags lowering,repro
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
If there is no log, omit `--log`. For local archival instead of API upload:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
lagora report --store /path/to/issue-store --kernel /path/to/kernel.py --title "..." --reporter "agent" --description-file /tmp/legato-agora-report.md
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Auto-Generate A Repro Kernel
|
|
215
|
+
|
|
216
|
+
Use this only when the user asks for automation or no kernel artifact is available but the failure description/log contains enough shape, dtype, operation, and Legato API context to create a plausible minimal repro.
|
|
217
|
+
|
|
218
|
+
**Start from `reference/kernel-with-golden.py` in this skill.** It is a complete,
|
|
219
|
+
verified harness-driven submission. Copy it and change three things: `inputs`,
|
|
220
|
+
`golden`, and `kernel`. Do not write a launcher from memory; the site harness
|
|
221
|
+
owns stage selection, stage output directories, lowering-only launch behavior,
|
|
222
|
+
and the value verdict.
|
|
223
|
+
|
|
224
|
+
Rules:
|
|
225
|
+
|
|
226
|
+
- Put generated files under `/tmp/lagora-repro-<short-name>/`.
|
|
227
|
+
- Name the file `generated_repro_kernel.py`.
|
|
228
|
+
- Keep the reference's module-level structure. The site reads `inputs`, `SHAPES`, `golden`, and the decorated kernel by name, so do not rename them.
|
|
229
|
+
- Write tensor shapes as **literals** in the annotations and in the kernel body. legato recompiles that source where module constants are not in scope and fails with `error[LE0003]: Undefined variable`.
|
|
230
|
+
- Keep the kernel at module level; legato reads its source with `inspect.getsource`.
|
|
231
|
+
- Do not add a custom `main`, `run_lowering`, or `legato.session`. In particular, never add a hardcoded `OutputType.BINARY`; doing so bypasses the site harness and can put `.bin` files under every lowering stage.
|
|
232
|
+
- If the kernel leaves a dimension dynamic, declare `SHAPES = {"a": (4096, 256), ...}` to pin the size the failure needs. Otherwise the site substitutes one and says so in the log.
|
|
233
|
+
- `inputs` returns values keyed by parameter name. Supply the values the failure actually happens on; without them the site uses seeded random data, which is reproducible but may be a different case.
|
|
234
|
+
- `golden` is the reference answer in plain torch. Write it only when the intended result is actually known. Without it the kernel still lowers and runs; the site reports the value check as unavailable, which is honest. **Never write a `golden` that returns the kernel's own output** -- that manufactures a pass and hides the bug being reported.
|
|
235
|
+
- State in the report that the kernel is agent-generated and may need confirmation.
|
|
236
|
+
|
|
237
|
+
Before reporting, ask production dispatch to validate the generated file:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
lagora playground validate --kernel /tmp/lagora-repro-case/generated_repro_kernel.py
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The command must accept the file. If production dispatch says the file has its
|
|
244
|
+
own launcher, remove the launcher/session and restore the reference shape
|
|
245
|
+
before submission.
|
|
246
|
+
|
|
247
|
+
Then report it normally:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
lagora report \
|
|
251
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
252
|
+
--kernel /tmp/lagora-repro-case/generated_repro_kernel.py \
|
|
253
|
+
--title "agent-generated lowering repro for <symptom>" \
|
|
254
|
+
--reporter "agent" \
|
|
255
|
+
--description-file /tmp/legato-agora-report.md \
|
|
256
|
+
--tags lowering,generated-repro
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Run Lowering Reproduction Automatically
|
|
260
|
+
|
|
261
|
+
For a new report, ask the CLI to run staged lowering after storing the issue:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
lagora report \
|
|
265
|
+
--store /path/to/issue-store \
|
|
266
|
+
--kernel /path/to/kernel.py \
|
|
267
|
+
--log /path/to/error.log \
|
|
268
|
+
--title "lowering failure" \
|
|
269
|
+
--reporter "agent" \
|
|
270
|
+
--description-file /tmp/legato-agora-report.md \
|
|
271
|
+
--auto-lowering \
|
|
272
|
+
--sdk-root /root/workspace/hyperaccel-sdk \
|
|
273
|
+
--python /root/workspace/hyperaccel-sdk/.venv/bin/python \
|
|
274
|
+
--stages MLIR,CORE_IR,BACKEND_IR,ASM,BINARY
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
For an existing issue:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
lagora verify \
|
|
281
|
+
--store /path/to/issue-store \
|
|
282
|
+
--issue <issue-id> \
|
|
283
|
+
--kind lowering \
|
|
284
|
+
--mode real \
|
|
285
|
+
--sdk-root /root/workspace/hyperaccel-sdk \
|
|
286
|
+
--python /root/workspace/hyperaccel-sdk/.venv/bin/python \
|
|
287
|
+
--stages MLIR,CORE_IR,BACKEND_IR,ASM,BINARY
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Add `--kernel-function <name>` when needed. Use `--mode plan` only when the user wants a recorded plan/skipped verification instead of real execution.
|
|
291
|
+
|
|
292
|
+
## Fetch, Inspect, And Download Issue Files
|
|
293
|
+
|
|
294
|
+
Use `fetch` to download the full issue bundle and artifacts for debugging. Fetching an `open` issue is also a response signal: it marks the issue `investigating` so the reporter can see that a language developer or agent has started looking at it.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
lagora fetch \
|
|
298
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
299
|
+
--issue <issue-id> \
|
|
300
|
+
--author "agent" \
|
|
301
|
+
--out ./lagora-issues/<issue-id>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
For local issue-store:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
lagora fetch --store /path/to/issue-store --issue <issue-id> --author "agent" --out ./lagora-issues/<issue-id>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Use `issue fetch` when you need a quick textual or JSON inspection:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
lagora issue fetch --store /path/to/issue-store --issue <issue-id>
|
|
314
|
+
lagora issue fetch --store /path/to/issue-store --issue <issue-id> --format json
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
After checkout, inspect:
|
|
318
|
+
|
|
319
|
+
- `issue.json` for status, tags, artifacts, occurrences, comments, and verification runs
|
|
320
|
+
- `description.md` for the original report
|
|
321
|
+
- downloaded kernel/log artifacts for reproduction
|
|
322
|
+
- `verification-output-*.log` for lowering stage failures
|
|
323
|
+
|
|
324
|
+
Do not paste large logs into chat. Summarize the relevant stage, stack frame, and error lines.
|
|
325
|
+
|
|
326
|
+
## Search Existing Issues
|
|
327
|
+
|
|
328
|
+
Use search whenever a user asks whether a failure is known, asks for similar issues, or before filing a new report. Search uses local similarity scoring over issue title, description, tags, comments, and artifact filenames; it is not proof of duplication.
|
|
329
|
+
|
|
330
|
+
Remote board:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
lagora search \
|
|
334
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
335
|
+
--query "matmul lowering verifier total physical bytes" \
|
|
336
|
+
--limit 10
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Local issue-store:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
lagora search --store /path/to/issue-store --query "runtime loop cgdma warning"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Search output gives issue id, status, score, title, and match reasons. Use it this way:
|
|
346
|
+
|
|
347
|
+
- High score plus same failed stage and diagnostic: likely duplicate; fetch the issue and add an occurrence/comment.
|
|
348
|
+
- Same operator family but different stage or diagnostic: related; cite it but do not block a new report.
|
|
349
|
+
- Resolved match: tell the user the fixed version/workaround if recorded, then compare with their SDK commit before closing.
|
|
350
|
+
|
|
351
|
+
## Structured Comments And Status
|
|
352
|
+
|
|
353
|
+
Comments should be normalized because most users are expected to work through agents and this skill. Always prefer a structured comment over free-form prose.
|
|
354
|
+
|
|
355
|
+
The first block must be YAML frontmatter for machines. The site may hide this block, so do not rely on it for human communication. The markdown body after the frontmatter must read like a real Korean comment written for a person, not like formatted YAML repeated in prose.
|
|
356
|
+
|
|
357
|
+
Hidden frontmatter exists to let agents, CLI commands, and the site automate four decisions:
|
|
358
|
+
|
|
359
|
+
- status transition evidence: whether a comment should move or justify `investigating`, `resolved`, `needs_info`, `duplicate`, or `blocked`
|
|
360
|
+
- next-action routing: whether the reporter, language team, agent, or nobody should act next
|
|
361
|
+
- similarity handling: whether this issue is canonical, duplicate, related, or shares the same root cause
|
|
362
|
+
- resolution guidance: whether a fixed version, commit, workaround, or verification result is strong enough to guide future reports
|
|
363
|
+
|
|
364
|
+
Use these comment categories:
|
|
365
|
+
|
|
366
|
+
- `triage`: first classification and likely owner/component
|
|
367
|
+
- `reproduction`: reproduction succeeded or failed
|
|
368
|
+
- `root_cause`: suspected or confirmed cause
|
|
369
|
+
- `workaround`: user-facing workaround
|
|
370
|
+
- `fix_candidate`: concrete code or design direction
|
|
371
|
+
- `verification`: verification result and evidence
|
|
372
|
+
- `release_note`: fixed version, commit, or upgrade guidance
|
|
373
|
+
- `needs_info`: missing reporter input blocks further diagnosis
|
|
374
|
+
|
|
375
|
+
Use this body shape for `lagora comment --body`. Keep tag values in English. Required v1 fields are `kind`, `stage`, `status_intent`, `reproduced`, `confidence`, and `next_action`. Delete unknown optional keys instead of leaving blank keys. For `stage`, use a workflow value when describing progress and a compiler/runtime value when identifying a failure location.
|
|
376
|
+
|
|
377
|
+
````markdown
|
|
378
|
+
---
|
|
379
|
+
kind: triage | reproduction | root_cause | workaround | fix_candidate | verification | release_note | needs_info
|
|
380
|
+
stage: report | fetch | reproduce | diagnose | patch | verify | release | MLIR | CORE_IR | BACKEND_IR | ASM | BINARY | fsim | compile | runtime | unknown
|
|
381
|
+
status_intent: investigating | resolved | needs_info | duplicate | blocked | none
|
|
382
|
+
reproduced: true | false | unknown
|
|
383
|
+
confidence: low | medium | high
|
|
384
|
+
next_action: reporter | language_team | agent | none
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## 요약
|
|
388
|
+
핵심 판단을 사람이 바로 이해할 수 있는 자연스러운 한국어 댓글로 1-2문장 적습니다.
|
|
389
|
+
|
|
390
|
+
## 근거
|
|
391
|
+
- 확인한 artifact, 로그 줄, stage, command를 짧게 적습니다. YAML 키를 그대로 나열하지 마세요.
|
|
392
|
+
|
|
393
|
+
## 다음 액션
|
|
394
|
+
- 누가 무엇을 하면 되는지 댓글 문장으로 적습니다.
|
|
395
|
+
````
|
|
396
|
+
|
|
397
|
+
Optional keys when known: `issue_relation`, `canonical_issue_id`, `related_issue_ids`, `similarity_basis`, `duplicate_of`, `fixed_version`, `fixed_commit`, `upgrade_advice`, `affected_versions`, `verification_scope`, `verification_result`, `artifact_ids`.
|
|
398
|
+
|
|
399
|
+
Visible comment body rules:
|
|
400
|
+
|
|
401
|
+
- Write Korean prose for a human reader; never list frontmatter keys again in the body.
|
|
402
|
+
- Say what changed, what evidence supports it, and what happens next.
|
|
403
|
+
- State uncertainty explicitly; do not mark guesses as confirmed.
|
|
404
|
+
- Keep logs short: quote only the decisive line or artifact name.
|
|
405
|
+
|
|
406
|
+
Compact body examples:
|
|
407
|
+
|
|
408
|
+
- `reproduction`: "첨부 artifact로 동일한 CORE_IR lowering 실패를 재현했습니다. 다음으로 reduction axis가 깨지는 pass를 좁히겠습니다."
|
|
409
|
+
- `needs_info`: "현재 로그만으로는 실패 stage를 확정하기 어렵습니다. reporter가 실행 명령과 전체 lowering 로그를 추가해야 합니다."
|
|
410
|
+
- `release_note`: "이 문제는 v1.4.2에서 해결된 패턴과 일치합니다. 같은 환경이라면 v1.4.2 이상으로 올리는 것을 권장합니다."
|
|
411
|
+
|
|
412
|
+
Post debugging findings with `--kind analysis` unless the comment contains a user-actionable fix or confirmed resolution:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
cat > /tmp/legato-agora-comment.md <<'EOF'
|
|
416
|
+
---
|
|
417
|
+
kind: reproduction
|
|
418
|
+
stage: CORE_IR
|
|
419
|
+
status_intent: investigating
|
|
420
|
+
reproduced: true
|
|
421
|
+
confidence: medium
|
|
422
|
+
next_action: language_team
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
첨부 artifact로 동일한 CORE_IR lowering 실패를 재현했습니다.
|
|
426
|
+
다음으로 reduction axis가 깨지는 pass를 좁히겠습니다.
|
|
427
|
+
EOF
|
|
428
|
+
|
|
429
|
+
lagora comment \
|
|
430
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
431
|
+
--issue <issue-id> \
|
|
432
|
+
--author "agent" \
|
|
433
|
+
--kind analysis \
|
|
434
|
+
--body "$(cat /tmp/legato-agora-comment.md)"
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Use `--kind solution` only when the comment contains a concrete fix, workaround, or resolved guidance. A `solution` comment moves the issue toward `resolved`; do not use it for speculative root-cause notes.
|
|
438
|
+
|
|
439
|
+
Update status when the investigation state changes:
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
lagora status \
|
|
443
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
444
|
+
--issue <issue-id> \
|
|
445
|
+
--author "agent" \
|
|
446
|
+
--status investigating
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Allowed statuses: `open`, `investigating`, `resolved`, `deferred`, `cancelled`.
|
|
450
|
+
|
|
451
|
+
Status guardrails:
|
|
452
|
+
|
|
453
|
+
- `open`: no one has started handling it.
|
|
454
|
+
- `investigating`: a language developer or agent has fetched artifacts or started analysis. `lagora fetch` automatically performs this transition for open issues.
|
|
455
|
+
- `resolved`: only after a confirmed fix, workaround, or upgrade path is recorded. Prefer `verification_result: passed` or a known `fixed_version` before running `lagora status --status resolved`.
|
|
456
|
+
- `deferred`: valid issue, but intentionally not being handled now.
|
|
457
|
+
- `cancelled`: invalid, misfiled, or not actionable as a Legato language issue.
|
|
458
|
+
- `status_intent` is evidence, not a command. Do not change issue status if the comment is speculative or asks for missing reporter input.
|
|
459
|
+
|
|
460
|
+
## Similarity And Duplicate Guidance
|
|
461
|
+
|
|
462
|
+
The board can group exact or similar reports by fingerprint/kernel evidence. Treat similarity as a decision aid, not as proof.
|
|
463
|
+
|
|
464
|
+
When reporting a new issue:
|
|
465
|
+
|
|
466
|
+
- Run `lagora search` with the strongest diagnostic terms, stage, operator name, and any unique warning/error text.
|
|
467
|
+
- Check for similar unresolved issues when the same kernel, checksum, failure stage, or diagnostic signature appears.
|
|
468
|
+
- If a similar unresolved issue exists, prefer adding an occurrence or comment to that issue instead of creating a new issue.
|
|
469
|
+
- If a similar resolved issue exists, do not hard-block by default. Tell the user which issue appears related, what fixed version or workaround was recorded, and ask whether to submit anyway if the current environment/version differs.
|
|
470
|
+
- Only recommend hard-blocking a report for a hard duplicate: same fingerprint, or same kernel checksum plus same failed stage and diagnostic signature.
|
|
471
|
+
- Treat same stage plus similar diagnostic as `related`; treat same operator family only as a weak signal.
|
|
472
|
+
|
|
473
|
+
When resolving an issue:
|
|
474
|
+
|
|
475
|
+
- Look for grouped occurrences and related issue IDs before marking only one report resolved.
|
|
476
|
+
- If the same fingerprint group is covered by the same fix, update the canonical issue and leave a structured `release_note` or `verification` comment that references the affected reports.
|
|
477
|
+
- If the match is only approximate, do not bulk-resolve. Add related links and keep separate statuses.
|
|
478
|
+
|
|
479
|
+
## Site Feedback Inbox
|
|
480
|
+
|
|
481
|
+
Use site feedback for requests about the Lagora site itself: UI layout, navigation, settings, workflow friction, missing controls, confusing wording, or agent/CLI affordances. Do not use it for Legato kernel bugs; those should be ordinary issues.
|
|
482
|
+
|
|
483
|
+
List or fetch open feedback:
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
lagora feedback fetch \
|
|
487
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
488
|
+
--status open
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Local issue-store:
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
lagora feedback list --store /path/to/issue-store
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Resolve after implementing or intentionally declining:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
lagora feedback resolve \
|
|
501
|
+
--api-url https://legato-dev-agora.hyperaccel.net/legato-dev-agora \
|
|
502
|
+
--id <feedback-id> \
|
|
503
|
+
--author "agent"
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
When acting on feedback:
|
|
507
|
+
|
|
508
|
+
- Fetch/list first and quote the feedback id in your work notes.
|
|
509
|
+
- If it maps to a code change, implement and verify the change before resolving.
|
|
510
|
+
- If it is vague, leave it open and ask for clarification through the normal conversation; do not mark it resolved just because it was read.
|
|
511
|
+
|
|
512
|
+
## Report Body Template
|
|
513
|
+
|
|
514
|
+
````markdown
|
|
515
|
+
## TL;DR
|
|
516
|
+
무엇이 실패했는지 한두 문장으로 요약합니다.
|
|
517
|
+
|
|
518
|
+
## 실패 지점
|
|
519
|
+
- Stage: `lowering | fsim | compile | runtime | unknown`
|
|
520
|
+
- 의심 pass/component: `알고 있으면 작성`
|
|
521
|
+
- 영향도: `lowering 차단 | 결과 불일치 | flaky | 확인 요청`
|
|
522
|
+
|
|
523
|
+
## 재현 방법
|
|
524
|
+
```bash
|
|
525
|
+
실행한 명령 또는 재현 명령
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## 기대 결과
|
|
529
|
+
정상이라면 어떤 결과가 나와야 하는지 적습니다.
|
|
530
|
+
|
|
531
|
+
## 실제 결과
|
|
532
|
+
실제로 어떤 실패가 발생했는지 적습니다.
|
|
533
|
+
|
|
534
|
+
## 핵심 에러
|
|
535
|
+
```text
|
|
536
|
+
짧은 핵심 에러 5~20줄. 원문 에러 메시지는 번역하지 않습니다.
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
## 언어팀 확인 요청
|
|
540
|
+
- 의심되는 원인
|
|
541
|
+
- 확인해줬으면 하는 부분
|
|
542
|
+
- 관련 커널 패턴
|
|
543
|
+
|
|
544
|
+
## 첨부/자동 수집 정보
|
|
545
|
+
- 커널 파일과 전체 로그는 artifact로 첨부됩니다.
|
|
546
|
+
- Legato 버전, git 상태, checksum, OS/Python/Node 정보는 CLI가 자동 수집합니다.
|
|
547
|
+
````
|
|
548
|
+
|
|
549
|
+
## Safety And Quality
|
|
550
|
+
|
|
551
|
+
- Do not run destructive commands.
|
|
552
|
+
- Do not execute arbitrary kernels unless the user asks for reproduction or verification.
|
|
553
|
+
- Do not include credentials, tokens, secrets, or unrelated private paths in reports/comments.
|
|
554
|
+
- Prefer absolute paths for local reproduction traceability.
|
|
555
|
+
- If a command fails, report the exact command attempted and the important error lines.
|
|
556
|
+
- When using generated repro kernels, label them as generated and avoid overstating certainty.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Reference submission for Legato Dev Agora. Copy this file and change three things.
|
|
2
|
+
|
|
3
|
+
1. `inputs` -- the values the failure happens on. Both the kernel and the
|
|
4
|
+
reference are given exactly these, so a bug that only reproduces on
|
|
5
|
+
particular numbers actually reproduces.
|
|
6
|
+
2. `golden` -- the same computation in plain torch. This is what the site
|
|
7
|
+
checks the kernel against, so keep it simple enough to be obviously right.
|
|
8
|
+
3. `kernel` -- the Legato function being reported.
|
|
9
|
+
|
|
10
|
+
Nothing else is required. The site allocates the tensors, places them, runs the
|
|
11
|
+
session and reports the verdict; shapes, dtypes and device layouts are all read
|
|
12
|
+
off the annotations below. In particular, do not add `legato.session`, a
|
|
13
|
+
launcher, or a `__main__` block. Those bypass the site harness that selects each
|
|
14
|
+
lowering stage and maps it to the matching artifact directory.
|
|
15
|
+
|
|
16
|
+
Two rules that are easy to get wrong:
|
|
17
|
+
|
|
18
|
+
* Write shapes as literals in the annotations and in the body. legato
|
|
19
|
+
recompiles this function's source on its own, where module constants are not
|
|
20
|
+
in scope, and reports `error[LE0003]: Undefined variable`.
|
|
21
|
+
* Keep the kernel at module level. legato reads its source with
|
|
22
|
+
inspect.getsource.
|
|
23
|
+
|
|
24
|
+
If the kernel leaves a dimension dynamic, add `SHAPES = {"a": (4096, 256), ...}`
|
|
25
|
+
to pin the size the failure needs; otherwise the site substitutes one and says
|
|
26
|
+
so in the log. Without `inputs` the site uses seeded random data, which is
|
|
27
|
+
reproducible but is not the case being reported -- supply it whenever the
|
|
28
|
+
failure depends on the values. Without a `golden` the kernel still lowers and
|
|
29
|
+
runs; the site just reports the value check as unavailable rather than claiming
|
|
30
|
+
a pass it cannot support.
|
|
31
|
+
|
|
32
|
+
Verified end to end against a prepared runtime: lower=pass, fsim=pass,
|
|
33
|
+
value=pass, max_abs_diff=0.067560.
|
|
34
|
+
"""
|
|
35
|
+
# type: ignore
|
|
36
|
+
# ruff: noqa
|
|
37
|
+
from __future__ import annotations
|
|
38
|
+
|
|
39
|
+
import legato
|
|
40
|
+
import legato.model.bertha as bertha
|
|
41
|
+
|
|
42
|
+
RTOL = 0.05
|
|
43
|
+
ATOL = 0.2
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def get_bertha(ctx):
|
|
47
|
+
return bertha.Bertha(ctx, "bertha", 32, False, 8, 128 * 1024**3)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def inputs():
|
|
51
|
+
"""The values to run on. Shapes must match the kernel's annotations."""
|
|
52
|
+
import torch
|
|
53
|
+
|
|
54
|
+
torch.manual_seed(0)
|
|
55
|
+
return {
|
|
56
|
+
"a": (torch.rand(20, 256) * 2 - 1).to(torch.bfloat16),
|
|
57
|
+
"b": (torch.rand(256, 128) * 2 - 1).to(torch.bfloat16),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def golden(a, b):
|
|
62
|
+
import torch
|
|
63
|
+
|
|
64
|
+
return torch.matmul(a.float(), b.float())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@legato.compile(backend=get_bertha, param_kinds={"a": "universal", "b": "top", "out": "core"})
|
|
68
|
+
def kernel(
|
|
69
|
+
a: legato.get_model().tensor_type(legato.types.float("bfloat16"), (20, 256), "shared_dram"),
|
|
70
|
+
b: legato.get_model().tensor_type(legato.types.float("bfloat16"), [256, 128], "mpu_dram"),
|
|
71
|
+
out: legato.get_model().tensor_type(legato.types.float("bfloat16"), (20, 128), "shared_dram"),
|
|
72
|
+
):
|
|
73
|
+
device = legato.get_context().get_device()
|
|
74
|
+
|
|
75
|
+
with device.get_top():
|
|
76
|
+
legato.tensor.request_load(a, device.get_core(0), "sram")
|
|
77
|
+
legato.tensor.request_load(b, device.get_core(0), "mpu_buffer")
|
|
78
|
+
|
|
79
|
+
with device.get_core(0):
|
|
80
|
+
weight_type = legato.get_model().tensor_type(legato.types.float("bfloat16"), [256, 128], "mpu_weight")
|
|
81
|
+
loaded_a = legato.tensor.receive(a, 0, "sram")
|
|
82
|
+
loaded_b = legato.tensor.receive_type(weight_type, 0, None, "mpu_buffer")
|
|
83
|
+
|
|
84
|
+
legato.tensor.memcpy(out, loaded_a @ loaded_b)
|