wafer-lsp 0.1.7__tar.gz
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.
- wafer_lsp-0.1.7/.gitignore +118 -0
- wafer_lsp-0.1.7/PKG-INFO +60 -0
- wafer_lsp-0.1.7/README.md +37 -0
- wafer_lsp-0.1.7/pyproject.toml +73 -0
- wafer_lsp-0.1.7/pyproject.toml.bak +73 -0
- wafer_lsp-0.1.7/src/wafer_lsp/__init__.py +1 -0
- wafer_lsp-0.1.7/src/wafer_lsp/__main__.py +9 -0
- wafer_lsp-0.1.7/src/wafer_lsp/analyzers/__init__.py +0 -0
- wafer_lsp-0.1.7/src/wafer_lsp/analyzers/compiler_integration.py +16 -0
- wafer_lsp-0.1.7/src/wafer_lsp/analyzers/docs_index.py +36 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/__init__.py +30 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/code_action.py +48 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/code_lens.py +48 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/completion.py +6 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/diagnostics.py +41 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/document_symbol.py +176 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/hip_diagnostics.py +303 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/hover.py +251 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/inlay_hint.py +245 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/semantic_tokens.py +224 -0
- wafer_lsp-0.1.7/src/wafer_lsp/handlers/workspace_symbol.py +87 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/README.md +195 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/__init__.py +17 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/converter.py +88 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/detector.py +107 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/parser_manager.py +33 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/registry.py +120 -0
- wafer_lsp-0.1.7/src/wafer_lsp/languages/types.py +37 -0
- wafer_lsp-0.1.7/src/wafer_lsp/parsers/__init__.py +36 -0
- wafer_lsp-0.1.7/src/wafer_lsp/parsers/base_parser.py +9 -0
- wafer_lsp-0.1.7/src/wafer_lsp/parsers/cuda_parser.py +95 -0
- wafer_lsp-0.1.7/src/wafer_lsp/parsers/cutedsl_parser.py +114 -0
- wafer_lsp-0.1.7/src/wafer_lsp/parsers/hip_parser.py +688 -0
- wafer_lsp-0.1.7/src/wafer_lsp/server.py +58 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/__init__.py +38 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/analysis_service.py +22 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/docs_service.py +40 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/document_service.py +20 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/hip_docs.py +806 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/hip_hover_service.py +412 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/hover_service.py +237 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/language_registry_service.py +26 -0
- wafer_lsp-0.1.7/src/wafer_lsp/services/position_service.py +77 -0
- wafer_lsp-0.1.7/src/wafer_lsp/utils/__init__.py +0 -0
- wafer_lsp-0.1.7/src/wafer_lsp/utils/lsp_helpers.py +79 -0
- wafer_lsp-0.1.7/tests/__init__.py +1 -0
- wafer_lsp-0.1.7/tests/fixtures/example.hip +265 -0
- wafer_lsp-0.1.7/tests/test_converter.py +121 -0
- wafer_lsp-0.1.7/tests/test_cutedsl_parser.py +60 -0
- wafer_lsp-0.1.7/tests/test_hip_diagnostics.py +335 -0
- wafer_lsp-0.1.7/tests/test_hip_hover.py +374 -0
- wafer_lsp-0.1.7/tests/test_hip_parser.py +384 -0
- wafer_lsp-0.1.7/tests/test_language_detector.py +59 -0
- wafer_lsp-0.1.7/tests/test_lsp_e2e.py +591 -0
- wafer_lsp-0.1.7/tests/test_lsp_handlers.py +57 -0
- wafer_lsp-0.1.7/tests/test_parser_manager.py +57 -0
- wafer_lsp-0.1.7/uv.lock +1732 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
*.pyc
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
*.so
|
|
7
|
+
.Python
|
|
8
|
+
*.egg-info/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
ENV/
|
|
15
|
+
|
|
16
|
+
# Distribution / packaging
|
|
17
|
+
dist/
|
|
18
|
+
build/
|
|
19
|
+
*.egg
|
|
20
|
+
|
|
21
|
+
# IDE
|
|
22
|
+
.vscode/
|
|
23
|
+
.cursor/
|
|
24
|
+
.idea/
|
|
25
|
+
*.swp
|
|
26
|
+
*.swo
|
|
27
|
+
*~
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|
|
32
|
+
|
|
33
|
+
# Temporary files
|
|
34
|
+
*.tmp
|
|
35
|
+
tests.txt
|
|
36
|
+
output.txt
|
|
37
|
+
|
|
38
|
+
# Evaluation results
|
|
39
|
+
experiments/emilio/cutedsl-quack-eval/eval_results/*.txt
|
|
40
|
+
experiments/emilio/cutedsl-quack-eval/eval_results/*.json
|
|
41
|
+
experiments/emilio/cutedsl-quack-eval/eval_results/*.py
|
|
42
|
+
research/evals/kernelbench/results/
|
|
43
|
+
research/evals/retrieval_eval_project/results/
|
|
44
|
+
research/evals/trace_analyze_eval/results/
|
|
45
|
+
research/evals/**/uv.lock
|
|
46
|
+
|
|
47
|
+
# Large trace files
|
|
48
|
+
**/pmc_perf.csv
|
|
49
|
+
wafer_artifacts/
|
|
50
|
+
**/wafer_artifacts/
|
|
51
|
+
/.deps/
|
|
52
|
+
|
|
53
|
+
# Local config files
|
|
54
|
+
services/docs-tool/config.yaml
|
|
55
|
+
|
|
56
|
+
# Environment files with secrets
|
|
57
|
+
.env
|
|
58
|
+
.env.local
|
|
59
|
+
.env.*.local
|
|
60
|
+
node_modules/
|
|
61
|
+
.vscode-test/
|
|
62
|
+
|
|
63
|
+
# npm artifacts (using yarn)
|
|
64
|
+
package-lock.json
|
|
65
|
+
npm-debug.log*
|
|
66
|
+
.npm/
|
|
67
|
+
.npmrc
|
|
68
|
+
|
|
69
|
+
# Yarn artifacts
|
|
70
|
+
**/.yarn/install-state.gz
|
|
71
|
+
|
|
72
|
+
# NSYS report files (can be very large)
|
|
73
|
+
*.nsys-rep
|
|
74
|
+
|
|
75
|
+
# ROCprofiler artifacts
|
|
76
|
+
.rocprofv3/
|
|
77
|
+
|
|
78
|
+
# Turbo build cache
|
|
79
|
+
.turbo/
|
|
80
|
+
**/.turbo/
|
|
81
|
+
|
|
82
|
+
# Supabase CLI temp files
|
|
83
|
+
supabase/.branches/
|
|
84
|
+
supabase/.temp/
|
|
85
|
+
**/supabase/.branches/
|
|
86
|
+
**/supabase/.temp/
|
|
87
|
+
|
|
88
|
+
# Eval results (generated, large)
|
|
89
|
+
research/evals/kernelbench/kernelbench/results/
|
|
90
|
+
research/evals/retrieval_eval_project/retrieval_eval/results/
|
|
91
|
+
research/evals/retrieval_eval_project/*.log
|
|
92
|
+
research/evals/ask_domain_eval/results/
|
|
93
|
+
research/evals/optimize_performance_eval/results/
|
|
94
|
+
research/evals/**/eval_output*.log
|
|
95
|
+
|
|
96
|
+
# Wafer extension trace files
|
|
97
|
+
.wafer/traces/
|
|
98
|
+
|
|
99
|
+
# Test coverage
|
|
100
|
+
coverage/
|
|
101
|
+
**/coverage/
|
|
102
|
+
.coverage
|
|
103
|
+
*.coverage
|
|
104
|
+
coverage.xml
|
|
105
|
+
*.lcov
|
|
106
|
+
htmlcov/
|
|
107
|
+
experiments/steve/amd-model-practice/workloads/**/*.csv
|
|
108
|
+
experiments/steve/amd-model-practice/liquid_profile.json
|
|
109
|
+
|
|
110
|
+
# Local files
|
|
111
|
+
logs/
|
|
112
|
+
todo.md
|
|
113
|
+
|
|
114
|
+
# Claude Code context/handoffs
|
|
115
|
+
.claude/context/
|
|
116
|
+
.claude/handoffs/
|
|
117
|
+
KernelBench/
|
|
118
|
+
HIP-Benchmarks-Results/
|
wafer_lsp-0.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wafer-lsp
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Language Server Protocol server for GPU programming languages
|
|
5
|
+
Author-email: Wafer <support@wafer.ai>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: c++,cuda,cutedsl,gpu,language-server,lsp
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Requires-Dist: lsprotocol>=2024.0.0
|
|
17
|
+
Requires-Dist: pygls>=1.0.0
|
|
18
|
+
Requires-Dist: wafer-core
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Wafer LSP
|
|
25
|
+
|
|
26
|
+
Language Server Protocol server for CuTeDSL (Python GPU programming).
|
|
27
|
+
|
|
28
|
+
**Beta Feature**: Currently only available when Beta Mode is enabled in VS Code settings.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **Hover Information**: Shows kernel and layout information with compiler analysis when hovering over CuTeDSL code
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install wafer-lsp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### VS Code Extension
|
|
43
|
+
|
|
44
|
+
The LSP server is integrated into the `wevin-extension` VS Code extension. It starts automatically when Beta Mode is enabled.
|
|
45
|
+
|
|
46
|
+
### Standalone
|
|
47
|
+
|
|
48
|
+
For Neovim or other editors:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m wafer_lsp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Supported Languages
|
|
55
|
+
|
|
56
|
+
- **CuTeDSL**: Python files with `@cute.kernel` decorators
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
|
|
60
|
+
The LSP server uses a modular language registry system. Currently supports CuTeDSL only. See `languages/README.md` for details on adding more languages.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Wafer LSP
|
|
2
|
+
|
|
3
|
+
Language Server Protocol server for CuTeDSL (Python GPU programming).
|
|
4
|
+
|
|
5
|
+
**Beta Feature**: Currently only available when Beta Mode is enabled in VS Code settings.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Hover Information**: Shows kernel and layout information with compiler analysis when hovering over CuTeDSL code
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install wafer-lsp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### VS Code Extension
|
|
20
|
+
|
|
21
|
+
The LSP server is integrated into the `wevin-extension` VS Code extension. It starts automatically when Beta Mode is enabled.
|
|
22
|
+
|
|
23
|
+
### Standalone
|
|
24
|
+
|
|
25
|
+
For Neovim or other editors:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m wafer_lsp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Supported Languages
|
|
32
|
+
|
|
33
|
+
- **CuTeDSL**: Python files with `@cute.kernel` decorators
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
The LSP server uses a modular language registry system. Currently supports CuTeDSL only. See `languages/README.md` for details on adding more languages.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wafer-lsp"
|
|
3
|
+
version = "0.1.7"
|
|
4
|
+
description = "Language Server Protocol server for GPU programming languages"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pygls>=1.0.0",
|
|
9
|
+
"lsprotocol>=2024.0.0",
|
|
10
|
+
"wafer-core", # For core analysis utilities
|
|
11
|
+
]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Wafer", email = "support@wafer.ai" }
|
|
14
|
+
]
|
|
15
|
+
license = { text = "MIT" }
|
|
16
|
+
keywords = ["lsp", "language-server", "gpu", "cuda", "cutedsl", "c++"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Topic :: Text Editors :: Integrated Development Environments (IDE)",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=8.0.0",
|
|
30
|
+
"pytest-asyncio>=0.23.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["hatchling"]
|
|
35
|
+
build-backend = "hatchling.build"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
wafer-lsp = "wafer_lsp.__main__:main"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/wafer_lsp"]
|
|
42
|
+
|
|
43
|
+
[tool.ruff]
|
|
44
|
+
line-length = 100
|
|
45
|
+
target-version = "py312"
|
|
46
|
+
preview = true
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = [
|
|
50
|
+
"E", # pycodestyle errors
|
|
51
|
+
"W", # pycodestyle warnings
|
|
52
|
+
"F", # pyflakes
|
|
53
|
+
"I", # isort
|
|
54
|
+
"B", # flake8-bugbear
|
|
55
|
+
"C4", # flake8-comprehensions
|
|
56
|
+
"UP", # pyupgrade
|
|
57
|
+
"ARG", # flake8-unused-arguments
|
|
58
|
+
"SIM", # flake8-simplify
|
|
59
|
+
"PLR", # pylint refactor
|
|
60
|
+
"PLW", # pylint warnings
|
|
61
|
+
"PT", # flake8-pytest-style
|
|
62
|
+
"RUF", # Ruff-specific rules
|
|
63
|
+
]
|
|
64
|
+
ignore = [
|
|
65
|
+
"E501", # line too long (handled by formatter)
|
|
66
|
+
"B008", # do not perform function calls in argument defaults
|
|
67
|
+
"PLR0913", # too many arguments
|
|
68
|
+
"PLR2004", # magic value used in comparison
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.format]
|
|
72
|
+
quote-style = "double"
|
|
73
|
+
indent-style = "space"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wafer-lsp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Language Server Protocol server for GPU programming languages"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pygls>=1.0.0",
|
|
9
|
+
"lsprotocol>=2024.0.0",
|
|
10
|
+
"wafer-core", # For core analysis utilities
|
|
11
|
+
]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Wafer", email = "support@wafer.ai" }
|
|
14
|
+
]
|
|
15
|
+
license = { text = "MIT" }
|
|
16
|
+
keywords = ["lsp", "language-server", "gpu", "cuda", "cutedsl", "c++"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Topic :: Text Editors :: Integrated Development Environments (IDE)",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=8.0.0",
|
|
30
|
+
"pytest-asyncio>=0.23.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["hatchling"]
|
|
35
|
+
build-backend = "hatchling.build"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
wafer-lsp = "wafer_lsp.__main__:main"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/wafer_lsp"]
|
|
42
|
+
|
|
43
|
+
[tool.ruff]
|
|
44
|
+
line-length = 100
|
|
45
|
+
target-version = "py312"
|
|
46
|
+
preview = true
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = [
|
|
50
|
+
"E", # pycodestyle errors
|
|
51
|
+
"W", # pycodestyle warnings
|
|
52
|
+
"F", # pyflakes
|
|
53
|
+
"I", # isort
|
|
54
|
+
"B", # flake8-bugbear
|
|
55
|
+
"C4", # flake8-comprehensions
|
|
56
|
+
"UP", # pyupgrade
|
|
57
|
+
"ARG", # flake8-unused-arguments
|
|
58
|
+
"SIM", # flake8-simplify
|
|
59
|
+
"PLR", # pylint refactor
|
|
60
|
+
"PLW", # pylint warnings
|
|
61
|
+
"PT", # flake8-pytest-style
|
|
62
|
+
"RUF", # Ruff-specific rules
|
|
63
|
+
]
|
|
64
|
+
ignore = [
|
|
65
|
+
"E501", # line too long (handled by formatter)
|
|
66
|
+
"B008", # do not perform function calls in argument defaults
|
|
67
|
+
"PLR0913", # too many arguments
|
|
68
|
+
"PLR2004", # magic value used in comparison
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.format]
|
|
72
|
+
quote-style = "double"
|
|
73
|
+
indent-style = "space"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
_analysis_cache: dict[str, dict[str, Any]] = {}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_analysis_for_kernel(uri: str, kernel_name: str) -> dict[str, Any] | None:
|
|
7
|
+
cache_key = f"{uri}:{kernel_name}"
|
|
8
|
+
|
|
9
|
+
if cache_key in _analysis_cache:
|
|
10
|
+
return _analysis_cache[cache_key]
|
|
11
|
+
|
|
12
|
+
return None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def clear_cache():
|
|
16
|
+
_analysis_cache.clear()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DocsIndex:
|
|
5
|
+
|
|
6
|
+
def __init__(self, docs_path: str | None = None):
|
|
7
|
+
if docs_path:
|
|
8
|
+
self.docs_path = Path(docs_path)
|
|
9
|
+
else:
|
|
10
|
+
self.docs_path = Path(__file__).parent.parent.parent.parent.parent / \
|
|
11
|
+
"curriculum" / "cutlass-docs" / "cutedsl-docs"
|
|
12
|
+
|
|
13
|
+
self.index = self._build_index()
|
|
14
|
+
|
|
15
|
+
def _build_index(self) -> dict[str, list[str]]:
|
|
16
|
+
return {
|
|
17
|
+
"layout": [
|
|
18
|
+
"intro-to-cutedsl.md",
|
|
19
|
+
"partitioning-strategies-inner-outer-threadvalue.md"
|
|
20
|
+
],
|
|
21
|
+
"TMA": ["blackwell-tutorial-fp16-gemm-0.md"],
|
|
22
|
+
"TMEM": ["colfax-blackwell-umma-tensor-memory-part1.md"],
|
|
23
|
+
"kernel": ["blackwell-tutorial-fp16-gemm-0.md"],
|
|
24
|
+
"struct": ["blackwell-tutorial-fp16-gemm-0.md"],
|
|
25
|
+
"pipeline": ["blackwell-tutorial-fp16-gemm-0.md"],
|
|
26
|
+
"MMA": ["mma-atoms-fundamentals-sm70-example.md"],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def get_doc_for_concept(self, concept: str) -> str | None:
|
|
30
|
+
concept_lower = concept.lower()
|
|
31
|
+
if self.index.get(concept_lower):
|
|
32
|
+
doc_file = self.index[concept_lower][0]
|
|
33
|
+
doc_path = self.docs_path / doc_file
|
|
34
|
+
if doc_path.exists():
|
|
35
|
+
return str(doc_path)
|
|
36
|
+
return None
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .code_action import handle_code_action
|
|
2
|
+
from .code_lens import handle_code_lens
|
|
3
|
+
from .completion import handle_completion
|
|
4
|
+
from .diagnostics import handle_diagnostics
|
|
5
|
+
from .document_symbol import handle_document_symbol
|
|
6
|
+
from .hip_diagnostics import (
|
|
7
|
+
HIPDiagnosticsProvider,
|
|
8
|
+
create_hip_diagnostics_provider,
|
|
9
|
+
get_hip_diagnostics,
|
|
10
|
+
)
|
|
11
|
+
from .hover import handle_hover
|
|
12
|
+
from .inlay_hint import handle_inlay_hint
|
|
13
|
+
from .semantic_tokens import handle_semantic_tokens, SEMANTIC_TOKENS_LEGEND
|
|
14
|
+
from .workspace_symbol import handle_workspace_symbol
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"handle_code_action",
|
|
18
|
+
"handle_code_lens",
|
|
19
|
+
"handle_completion",
|
|
20
|
+
"handle_diagnostics",
|
|
21
|
+
"handle_document_symbol",
|
|
22
|
+
"handle_hover",
|
|
23
|
+
"handle_inlay_hint",
|
|
24
|
+
"handle_semantic_tokens",
|
|
25
|
+
"handle_workspace_symbol",
|
|
26
|
+
"SEMANTIC_TOKENS_LEGEND",
|
|
27
|
+
"HIPDiagnosticsProvider",
|
|
28
|
+
"create_hip_diagnostics_provider",
|
|
29
|
+
"get_hip_diagnostics",
|
|
30
|
+
]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
from lsprotocol.types import CodeAction, CodeActionKind, Command, Range
|
|
3
|
+
|
|
4
|
+
from ..languages.registry import get_language_registry
|
|
5
|
+
from ..languages.types import KernelInfo
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def find_kernel_at_range(content: str, range: Range, uri: str) -> KernelInfo | None:
|
|
9
|
+
registry = get_language_registry()
|
|
10
|
+
language_info = registry.parse_file(uri, content)
|
|
11
|
+
|
|
12
|
+
if not language_info:
|
|
13
|
+
return None
|
|
14
|
+
|
|
15
|
+
for kernel in language_info.kernels:
|
|
16
|
+
if kernel.line <= range.start.line <= kernel.line + 50:
|
|
17
|
+
return kernel
|
|
18
|
+
|
|
19
|
+
return None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def handle_code_action(uri: str, range: Range, content: str) -> list[CodeAction]:
|
|
23
|
+
kernel = find_kernel_at_range(content, range, uri)
|
|
24
|
+
if not kernel:
|
|
25
|
+
return []
|
|
26
|
+
|
|
27
|
+
actions: list[CodeAction] = [
|
|
28
|
+
CodeAction(
|
|
29
|
+
title=f"Analyze Kernel: {kernel.name}",
|
|
30
|
+
kind=CodeActionKind.Source,
|
|
31
|
+
command=Command(
|
|
32
|
+
title=f"Analyze Kernel: {kernel.name}",
|
|
33
|
+
command="wafer.analyzeKernel",
|
|
34
|
+
arguments=[uri, kernel.name]
|
|
35
|
+
)
|
|
36
|
+
),
|
|
37
|
+
CodeAction(
|
|
38
|
+
title=f"Profile Kernel: {kernel.name}",
|
|
39
|
+
kind=CodeActionKind.Source,
|
|
40
|
+
command=Command(
|
|
41
|
+
title=f"Profile Kernel: {kernel.name}",
|
|
42
|
+
command="wafer.profileKernel",
|
|
43
|
+
arguments=[uri, kernel.name]
|
|
44
|
+
)
|
|
45
|
+
),
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
return actions
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
from lsprotocol.types import CodeLens, Command, Position, Range
|
|
3
|
+
|
|
4
|
+
from ..languages.registry import get_language_registry
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def handle_code_lens(uri: str, content: str) -> list[CodeLens]:
|
|
8
|
+
registry = get_language_registry()
|
|
9
|
+
language_info = registry.parse_file(uri, content)
|
|
10
|
+
|
|
11
|
+
if not language_info:
|
|
12
|
+
return []
|
|
13
|
+
|
|
14
|
+
lenses: list[CodeLens] = []
|
|
15
|
+
|
|
16
|
+
for kernel in language_info.kernels:
|
|
17
|
+
lens_range = Range(
|
|
18
|
+
start=Position(line=kernel.line, character=0),
|
|
19
|
+
end=Position(line=kernel.line, character=0)
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
analyze_command = Command(
|
|
23
|
+
title=f"Analyze {kernel.name}",
|
|
24
|
+
command="wafer.analyzeKernel",
|
|
25
|
+
arguments=[uri, kernel.name]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
profile_command = Command(
|
|
29
|
+
title=f"Profile {kernel.name}",
|
|
30
|
+
command="wafer.profileKernel",
|
|
31
|
+
arguments=[uri, kernel.name]
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
lenses.append(CodeLens(
|
|
35
|
+
range=lens_range,
|
|
36
|
+
command=analyze_command
|
|
37
|
+
))
|
|
38
|
+
|
|
39
|
+
profile_range = Range(
|
|
40
|
+
start=Position(line=kernel.line, character=20),
|
|
41
|
+
end=Position(line=kernel.line, character=20)
|
|
42
|
+
)
|
|
43
|
+
lenses.append(CodeLens(
|
|
44
|
+
range=profile_range,
|
|
45
|
+
command=profile_command
|
|
46
|
+
))
|
|
47
|
+
|
|
48
|
+
return lenses
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
from lsprotocol.types import Diagnostic
|
|
3
|
+
|
|
4
|
+
from ..languages.registry import get_language_registry
|
|
5
|
+
from .hip_diagnostics import get_hip_diagnostics
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def handle_diagnostics(
|
|
9
|
+
uri: str,
|
|
10
|
+
content: str,
|
|
11
|
+
enable_wavefront_diagnostics: bool = True,
|
|
12
|
+
) -> list[Diagnostic]:
|
|
13
|
+
"""Handle diagnostics for a document.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
uri: Document URI
|
|
17
|
+
content: Document content
|
|
18
|
+
enable_wavefront_diagnostics: Whether to enable HIP wavefront warnings
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
List of diagnostics
|
|
22
|
+
"""
|
|
23
|
+
diagnostics: list[Diagnostic] = []
|
|
24
|
+
|
|
25
|
+
registry = get_language_registry()
|
|
26
|
+
language_info = registry.parse_file(uri, content)
|
|
27
|
+
|
|
28
|
+
if not language_info:
|
|
29
|
+
return diagnostics
|
|
30
|
+
|
|
31
|
+
# Add HIP-specific diagnostics for HIP, CUDA, and C++ files
|
|
32
|
+
# (C++ files might contain HIP code if they have HIP markers)
|
|
33
|
+
if language_info.language in ("hip", "cuda", "cpp"):
|
|
34
|
+
hip_diagnostics = get_hip_diagnostics(
|
|
35
|
+
content,
|
|
36
|
+
uri,
|
|
37
|
+
enable_wavefront_diagnostics=enable_wavefront_diagnostics,
|
|
38
|
+
)
|
|
39
|
+
diagnostics.extend(hip_diagnostics)
|
|
40
|
+
|
|
41
|
+
return diagnostics
|