mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
patch 9.1.0906: filetype: Nvidia PTX files are not recognized
Problem: filetype: Nvidia PTX files are not recognized Solution: detect '*.ptx' files as ptx filetype (Yinzuo Jiang) Reference: https://docs.nvidia.com/cuda/parallel-thread-execution/ closes: #16171 Signed-off-by: Yinzuo Jiang <jiangyinzuo@foxmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
73785accfd
commit
bdb5f85a51
2
.github/MAINTAINERS
vendored
2
.github/MAINTAINERS
vendored
@ -249,6 +249,7 @@ runtime/ftplugin/postscr.vim @mrdubya
|
|||||||
runtime/ftplugin/prisma.vim @ribru17
|
runtime/ftplugin/prisma.vim @ribru17
|
||||||
runtime/ftplugin/ps1.vim @heaths
|
runtime/ftplugin/ps1.vim @heaths
|
||||||
runtime/ftplugin/ps1xml.vim @heaths
|
runtime/ftplugin/ps1xml.vim @heaths
|
||||||
|
runtime/ftplugin/ptx.vim @jiangyinzuo
|
||||||
runtime/ftplugin/purescript.vim @ribru17
|
runtime/ftplugin/purescript.vim @ribru17
|
||||||
runtime/ftplugin/pymanifest.vim @ObserverOfTime
|
runtime/ftplugin/pymanifest.vim @ObserverOfTime
|
||||||
runtime/ftplugin/python.vim @tpict
|
runtime/ftplugin/python.vim @tpict
|
||||||
@ -556,6 +557,7 @@ runtime/syntax/prolog.vim @XVilka
|
|||||||
runtime/syntax/ps1.vim @heaths
|
runtime/syntax/ps1.vim @heaths
|
||||||
runtime/syntax/ps1xml.vim @heaths
|
runtime/syntax/ps1xml.vim @heaths
|
||||||
runtime/syntax/psl.vim @danielkho
|
runtime/syntax/psl.vim @danielkho
|
||||||
|
runtime/syntax/ptx.vim @jiangyinzuo
|
||||||
runtime/syntax/pymanifest.vim @ObserverOfTime
|
runtime/syntax/pymanifest.vim @ObserverOfTime
|
||||||
runtime/syntax/qb64.vim @dkearns
|
runtime/syntax/qb64.vim @dkearns
|
||||||
runtime/syntax/qml.vim @ChaseKnowlden
|
runtime/syntax/qml.vim @ChaseKnowlden
|
||||||
|
@ -1976,6 +1976,10 @@ au BufNewFile,BufRead *.pk setf poke
|
|||||||
" Protocols
|
" Protocols
|
||||||
au BufNewFile,BufRead */etc/protocols setf protocols
|
au BufNewFile,BufRead */etc/protocols setf protocols
|
||||||
|
|
||||||
|
" Nvidia PTX (Parallel Thread Execution)
|
||||||
|
" See https://docs.nvidia.com/cuda/parallel-thread-execution/
|
||||||
|
au BufNewFile,BufRead *.ptx setf ptx
|
||||||
|
|
||||||
" Purescript
|
" Purescript
|
||||||
au BufNewFile,BufRead *.purs setf purescript
|
au BufNewFile,BufRead *.purs setf purescript
|
||||||
|
|
||||||
|
16
runtime/ftplugin/ptx.vim
Normal file
16
runtime/ftplugin/ptx.vim
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Nvidia PTX (Parellel Thread Execution)
|
||||||
|
" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
|
||||||
|
" Last Change: 2024-12-05
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Comments in PTX follow C/C++ syntax
|
||||||
|
" See: https://docs.nvidia.com/cuda/parallel-thread-execution/#syntax
|
||||||
|
setlocal commentstring=//\ %s
|
||||||
|
|
||||||
|
let b:undo_ftplugin = 'setl commentstring<'
|
52
runtime/syntax/ptx.vim
Normal file
52
runtime/syntax/ptx.vim
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Nvidia PTX (Parallel Thread Execution)
|
||||||
|
" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
|
||||||
|
" Latest Revision: 2024-12-05
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syntax iskeyword .,_,a-z,48-57
|
||||||
|
|
||||||
|
" https://docs.nvidia.com/cuda/parallel-thread-execution/#directives
|
||||||
|
syntax keyword ptxFunction .entry .func
|
||||||
|
syntax keyword ptxDirective .branchtargets .file .loc .secion .maxnctapersm .maxnreg .minnctapersm .noreturn .pragma .reqntid .target .version .weak
|
||||||
|
syntax keyword ptxOperator .address_size .alias .align .callprototype .calltargets
|
||||||
|
syntax keyword ptxStorageClass .common .const .extern .global .local .param .reg .sreg .shared .tex .visible
|
||||||
|
syntax keyword ptxType .explicitcluster .maxclusterrank .reqnctapercluster
|
||||||
|
|
||||||
|
" https://docs.nvidia.com/cuda/parallel-thread-execution/#fundamental-types
|
||||||
|
" signed integer
|
||||||
|
syntax keyword ptxType .s8 .s16 .s32 .s64
|
||||||
|
" unsigned integer
|
||||||
|
syntax keyword ptxType .u8 .u16 .u32 .u64
|
||||||
|
" floating-point
|
||||||
|
syntax keyword ptxType .f16 .f16x2 .f32 .f64
|
||||||
|
" bits (untyped)
|
||||||
|
syntax keyword ptxType .b8 .b16 .b32 .b64 .b128
|
||||||
|
" predicate
|
||||||
|
syntax keyword ptxType .pred
|
||||||
|
|
||||||
|
" https://docs.nvidia.com/cuda/parallel-thread-execution/#instruction-statements
|
||||||
|
syntax keyword ptxStatement ret
|
||||||
|
|
||||||
|
syntax region ptxCommentL start="//" skip="\\$" end="$" keepend
|
||||||
|
syntax region ptxComment matchgroup=ptxCommentStart start="/\*" end="\*/" extend
|
||||||
|
|
||||||
|
hi def link ptxFunction Function
|
||||||
|
hi def link ptxDirective Keyword
|
||||||
|
hi def link ptxOperator Operator
|
||||||
|
hi def link ptxStorageClass StorageClass
|
||||||
|
hi def link ptxType Type
|
||||||
|
hi def link ptxStatement Statement
|
||||||
|
|
||||||
|
hi def link ptxCommentL ptxComment
|
||||||
|
hi def link ptxCommentStart ptxComment
|
||||||
|
hi def link ptxComment Comment
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
@ -608,6 +608,7 @@ def s:GetFilenameChecks(): dict<list<string>>
|
|||||||
ps1xml: ['file.ps1xml'],
|
ps1xml: ['file.ps1xml'],
|
||||||
psf: ['file.psf'],
|
psf: ['file.psf'],
|
||||||
psl: ['file.psl'],
|
psl: ['file.psl'],
|
||||||
|
ptx: ['file.ptx'],
|
||||||
pug: ['file.pug'],
|
pug: ['file.pug'],
|
||||||
puppet: ['file.pp'],
|
puppet: ['file.pp'],
|
||||||
purescript: ['file.purs'],
|
purescript: ['file.purs'],
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
906,
|
||||||
/**/
|
/**/
|
||||||
905,
|
905,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user