Skip to content

Commit cbedf96

Browse files
committed
cuda: add ptx and sass syntax highlighting files
1 parent fe875d8 commit cbedf96

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

gpu/cuda/.vim/syntax/ptx.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
" SUPER LOUD PTX SYNTAX TEST
2+
3+
if exists("b:current_syntax")
4+
finish
5+
endif
6+
7+
" Make comments obvious
8+
syntax match ptxComment "//.*$"
9+
hi! link ptxComment Comment
10+
11+
" Make .entry and .func bright
12+
syntax match ptxEntry "\.entry"
13+
syntax match ptxFunc "\.func"
14+
hi! link ptxEntry Identifier
15+
hi! link ptxFunc Function
16+
17+
" Make registers and types stand out
18+
syntax match ptxReg "%[a-zA-Z0-9_]\+"
19+
syntax match ptxType "\.\(u32\|u64\|s32\|s64\|f32\|f64\|pred\)"
20+
hi! link ptxReg Constant
21+
hi! link ptxType Type
22+
23+
let b:current_syntax = "ptx"
24+

gpu/cuda/.vim/syntax/sasscuda.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
" SUPER LOUD CUDA SASS SYNTAX TEST
2+
3+
if exists("b:current_syntax")
4+
finish
5+
endif
6+
7+
" Comments like // something
8+
syntax match cudasassComment "//.*$"
9+
hi! link cudasassComment Comment
10+
11+
" Common directives
12+
syntax match cudasassDir "\.\(header\|target\|address_size\|maxnreg\|minnctapersm\)"
13+
hi! link cudasassDir PreProc
14+
15+
" Instructions (sample set – extend as you like)
16+
syntax keyword cudasassInstr MOV LDG STG LDS STS FFMA IMAD IADD SHF LOP3 BRA RET
17+
hi! link cudasassInstr Statement
18+
19+
" Registers: R0, R12, etc.
20+
syntax match cudasassReg "\<R[0-9]\+\>"
21+
hi! link cudasassReg Constant
22+
23+
" Predicates: P0, !P0, @P0, @!P0
24+
syntax match cudasassPred "@\?!\=P[0-9]\+"
25+
hi! link cudasassPred Identifier
26+
27+
let b:current_syntax = "cudasass"

gpu/cuda/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### CUDA examples
2+
3+
4+
### ptx and sass syntax highlighting
5+
Add the following to .vimrc:
6+
```
7+
au BufNewFile,BufRead *.ptx set filetype=ptx
8+
au BufNewFile,BufRead *.sass set filetype=sasscuda
9+
```
10+
And then copy the two file in .vim/syntax to `~/.vim/syntax/`.

0 commit comments

Comments
 (0)