Summary
Add editor-side syntax highlighting support for PTODSL so PTODSL-authored Python code is easier to read, review, and maintain.
Motivation / use case
PTODSL code uses a Python surface, but it carries a distinct DSL vocabulary such as @pto.jit, @pto.simd, @pto.simt, pto.for_, pto.if_, PTODSL surface types, and scalar.* helpers. Today these files are highlighted as plain Python, which makes PTODSL-specific constructs harder to visually scan in examples, docs, and kernel implementations.
A dedicated highlighting solution would help with:
- faster onboarding for PTODSL users
- clearer code review of PTODSL kernels and examples
- better readability in docs snippets and launch examples
- reduced confusion between ordinary Python control flow and PTODSL device-side control flow
Proposed API / behavior
A good first milestone would be a lightweight VS Code syntax-highlighting package that:
- highlights PTODSL decorators such as
@pto.jit, @pto.simd, @pto.simt, and @pto.cube
- highlights PTODSL control-flow helpers such as
pto.for_, pto.if_, pto.yield_, and br.then_ / br.else_
- highlights PTODSL surface types and enums under
pto.*
- highlights
scalar.* helpers
- works both for a dedicated PTODSL language mode and as an injection into ordinary Python files so existing
.py PTODSL sources benefit without renaming
The implementation can stay editor-only at first; no PTODSL runtime or compiler behavior needs to change.
Alternatives considered
- Continue using plain Python highlighting only. This is simple, but PTODSL-specific syntax remains visually hidden.
- Build a richer tree-sitter or language-server solution first. This may be valuable later, but a lightweight TextMate-based highlighter is a lower-risk starting point.
Additional context
A draft implementation had been prepared as a PR, but this request is being tracked as an issue first so the feature scope and preferred editor support can be discussed before merging code.
Summary
Add editor-side syntax highlighting support for PTODSL so PTODSL-authored Python code is easier to read, review, and maintain.
Motivation / use case
PTODSL code uses a Python surface, but it carries a distinct DSL vocabulary such as
@pto.jit,@pto.simd,@pto.simt,pto.for_,pto.if_, PTODSL surface types, andscalar.*helpers. Today these files are highlighted as plain Python, which makes PTODSL-specific constructs harder to visually scan in examples, docs, and kernel implementations.A dedicated highlighting solution would help with:
Proposed API / behavior
A good first milestone would be a lightweight VS Code syntax-highlighting package that:
@pto.jit,@pto.simd,@pto.simt, and@pto.cubepto.for_,pto.if_,pto.yield_, andbr.then_/br.else_pto.*scalar.*helpers.pyPTODSL sources benefit without renamingThe implementation can stay editor-only at first; no PTODSL runtime or compiler behavior needs to change.
Alternatives considered
Additional context
A draft implementation had been prepared as a PR, but this request is being tracked as an issue first so the feature scope and preferred editor support can be discussed before merging code.