Yinzuo Jiang | bdb5f85 | 2024-12-05 21:31:09 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Nvidia PTX (Parallel Thread Execution) |
| 3 | " Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com> |
| 4 | " Latest Revision: 2024-12-05 |
| 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | |
| 10 | let s:cpo_save = &cpo |
| 11 | set cpo&vim |
| 12 | |
| 13 | syntax iskeyword .,_,a-z,48-57 |
| 14 | |
| 15 | " https://docs.nvidia.com/cuda/parallel-thread-execution/#directives |
| 16 | syntax keyword ptxFunction .entry .func |
| 17 | syntax keyword ptxDirective .branchtargets .file .loc .secion .maxnctapersm .maxnreg .minnctapersm .noreturn .pragma .reqntid .target .version .weak |
| 18 | syntax keyword ptxOperator .address_size .alias .align .callprototype .calltargets |
| 19 | syntax keyword ptxStorageClass .common .const .extern .global .local .param .reg .sreg .shared .tex .visible |
| 20 | syntax keyword ptxType .explicitcluster .maxclusterrank .reqnctapercluster |
| 21 | |
| 22 | " https://docs.nvidia.com/cuda/parallel-thread-execution/#fundamental-types |
| 23 | " signed integer |
| 24 | syntax keyword ptxType .s8 .s16 .s32 .s64 |
| 25 | " unsigned integer |
| 26 | syntax keyword ptxType .u8 .u16 .u32 .u64 |
| 27 | " floating-point |
| 28 | syntax keyword ptxType .f16 .f16x2 .f32 .f64 |
| 29 | " bits (untyped) |
| 30 | syntax keyword ptxType .b8 .b16 .b32 .b64 .b128 |
| 31 | " predicate |
| 32 | syntax keyword ptxType .pred |
| 33 | |
| 34 | " https://docs.nvidia.com/cuda/parallel-thread-execution/#instruction-statements |
| 35 | syntax keyword ptxStatement ret |
| 36 | |
| 37 | syntax region ptxCommentL start="//" skip="\\$" end="$" keepend |
| 38 | syntax region ptxComment matchgroup=ptxCommentStart start="/\*" end="\*/" extend |
| 39 | |
| 40 | hi def link ptxFunction Function |
| 41 | hi def link ptxDirective Keyword |
| 42 | hi def link ptxOperator Operator |
| 43 | hi def link ptxStorageClass StorageClass |
| 44 | hi def link ptxType Type |
| 45 | hi def link ptxStatement Statement |
| 46 | |
| 47 | hi def link ptxCommentL ptxComment |
| 48 | hi def link ptxCommentStart ptxComment |
| 49 | hi def link ptxComment Comment |
| 50 | |
| 51 | let &cpo = s:cpo_save |
| 52 | unlet s:cpo_save |