Improve the Claude engine for SYCL generation#36
Conversation
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
…inked folders Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
…ernels. Signed-off-by: Weilin Xu <weilin.xu@intel.com>
|
@danielfleischer could you look at it? |
danielfleischer
left a comment
There was a problem hiding this comment.
Would changing the instructions in Claude.md.j2 from "triton" to SYCL" make Claude write SYCL kernels? are the skills Claude uses in the repo like analyze, benchmark, profile support non-Triton DSLs yet?
There was a problem hiding this comment.
Please don't create a settings.local.json for the user. If you want, you can create a settings.json and let the user override it with their own local file. Per the documented scope: https://code.claude.com/docs/en/settings#what-uses-scopes
I wouldn't allow anything; a few prompts and the user set these for themselves, with the understanding what is going on.
There was a problem hiding this comment.
Good catch! I have changed it to settings.json in de564ae
I think these are all reasonable permissions that will make it easier for users to scale up the experiments.
There was a problem hiding this comment.
Ok, I guess these tools are mostly read-only, except the trial manager.
There was a problem hiding this comment.
The agent also needs to write custom kernels into the workspace.
There was a problem hiding this comment.
The trial manager writes files by copying the generated candidates which are temp files into the workspace. The permission needed is to run python.
There was a problem hiding this comment.
The "temp files" are something like t0.py in the workspace in my runs. The agent still needs the write permission to save to ./workspace/t<iter>.py before the trial manage kicks in.
I am afraid allowing Python is too broad, because an agent can use Python to do anything. That's why I only allow the xe-forge-skill toolset (shall we call them xe-forge-tools instead in the Claude Code context?).
Do you have use cases that Python must be allowed?
| agent_dir.mkdir(parents=True, exist_ok=True) | ||
| (agent_dir / "tool-runner.md").write_text(_render("tool-runner.md.j2")) | ||
| (agent_dir / "tool-runner.md").write_text(_render("tool-runner.md.j2", dsl=dsl)) | ||
| (workspace / ".claude" / "settings.local.json").write_text(_render("settings.local.json.j2")) |
There was a problem hiding this comment.
I can move the convenient configs to my local ~/.claude/settings.json for my own use if people don't want it in the repo. @sandlbn, what's your thought?
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
|
@danielfleischer I needed to add more context and examples in e5294ae to let Claude Code generate PyTorch-inline SYCL*TLA code. |
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
This pull request implements a significant refactor to generalize the concept of the optimized kernel runtime from being Triton-specific (
triton_us) to a more flexible, DSL-agnostic field (custom_us). It also improves workspace generation by copying knowledge base directories instead of symlinking, introduces a new local settings file, and updates documentation and templates to reflect these changes.Generalization of optimized runtime field:
triton_uswith a genericcustom_usfield throughout the codebase, including state management, CLI arguments, result recording, and reporting. This enables support for non-Triton DSLs and improves extensibility. (src/xe_forge/core/trial_manager.py[1] [2] [3] [4] [5];src/xe_forge/pipeline.py[6];src/xe_forge/skills/__init__.py[7];src/xe_forge/skills/benchmark.py[8] [9];src/xe_forge/skills/trial.py[10]Workspace and knowledge base improvements:
Changes the workspace generator to copy both common and DSL/device-specific knowledge base directories into the workspace, instead of creating a symlink. This increases portability and robustness of generated workspaces. (
src/xe_forge/claude/generator.py[1] [2] [3] [4]Adds generation of a
.claude/settings.local.jsonfile with default permissions to the workspace. (src/xe_forge/claude/generator.py[1];src/xe_forge/claude/templates/settings.local.json.j2[2]Documentation and template updates:
Updates all relevant documentation and markdown/Jinja templates to use
custom_usin place oftriton_us, and to use the appropriate DSL name in command examples and profiling instructions. (src/xe_forge/claude/templates/CLAUDE.md.j2[1] [2] [3];src/xe_forge/claude/templates/tool-runner.md.j2[4]Adds a conditional correctness constraint for Triton kernels in the CLAUDE.md template. (
src/xe_forge/claude/templates/CLAUDE.md.j2src/xe_forge/claude/templates/CLAUDE.md.j2R79-R81)