Documentation
¶
Overview ¶
Package nvjitlink provides Go bindings for NVIDIA JIT linking of device code.
Link LTOIR, PTX, or cubin inputs and retrieve the resulting cubin or PTX.
Library search ¶
Load opens the path it is given. With an empty path it opens the path in NVJITLINK_LIB_PATH, if that is set. A path named either way is the only one tried: if it does not load, Load returns the error.
Otherwise Load, or the first call that needs the library, tries in order:
- the copy in the toolkit that CUDA_HOME names, then the one that CUDA_PATH names
- the system library names, which the dynamic loader resolves
- the copy in each installed /usr/local/cuda-N.M toolkit, newest first, then /usr/local/cuda
- the system library names in the directories pkg-config reports for nvJitLink
A library whose version these bindings do not accept is skipped.
Other ¶
Example ¶
Example links one PTX input into a cubin. It returns early when the nvJitLink library is not available. Real callers add several inputs — PTX from nvrtc, LTOIR, and device libraries — before calling Complete; the cubin can then be loaded with the driver package's ModuleLoadData.
package main
import (
"fmt"
"unsafe"
"github.com/tmc/lib/nvidia/nvjitlink"
)
func main() {
if _, _, err := nvjitlink.Version(); err != nil {
fmt.Println("nvJitLink unavailable:", err)
return
}
const ptx = `
.version 7.0
.target sm_70
.address_size 64
.visible .entry noop() { ret; }
`
h, err := nvjitlink.Create("-arch=sm_70")
if err != nil {
fmt.Println("create:", err)
return
}
defer h.Destroy()
code := []byte(ptx)
if err := h.AddData(nvjitlink.InputPtx, unsafe.Pointer(&code[0]), uint(len(code)), "noop.ptx"); err != nil {
fmt.Println("add:", err)
return
}
if err := h.Complete(); err != nil {
log, _ := h.ErrorLog()
fmt.Printf("link: %v\n%s", err, log)
return
}
cubin, err := h.LinkedCubin()
if err != nil {
fmt.Println("cubin:", err)
return
}
fmt.Println("linked", len(cubin), "bytes of cubin")
}
Output:
Index ¶
- Constants
- func BoundSymbol(name string) string
- func Close() error
- func CompilePTX(ptx []byte, arch string, opts ...string) (cubin []byte, info string, err error)
- func Has(symbol string) bool
- func HasAddData() bool
- func HasAddFile() bool
- func HasComplete() bool
- func HasCreate() bool
- func HasDestroy() bool
- func HasGetErrorLog() bool
- func HasGetErrorLogSize() bool
- func HasGetInfoLog() bool
- func HasGetInfoLogSize() bool
- func HasGetLinkedCubin() bool
- func HasGetLinkedCubinSize() bool
- func HasGetLinkedLTOIR() bool
- func HasGetLinkedLTOIRSize() bool
- func HasGetLinkedPtx() bool
- func HasGetLinkedPtxSize() bool
- func HasVersion() bool
- func Load(path string) error
- func Loaded() bool
- func Path() string
- func ValidateOption(flag string) error
- func Version() (major uint32, minor uint32, err error)
- type BindFailure
- type CallError
- type Handle
- func (h Handle) AddData(inputType InputType, data unsafe.Pointer, size uint, name string) error
- func (h Handle) AddFile(inputType InputType, fileName string) error
- func (h Handle) Complete() error
- func (h *Handle) Destroy() error
- func (h Handle) ErrorLog() (string, error)
- func (h Handle) ErrorLogSize() (uint, error)
- func (h Handle) InfoLog() (string, error)
- func (h Handle) InfoLogSize() (uint, error)
- func (h Handle) LinkedCubin() ([]byte, error)
- func (h Handle) LinkedCubinSize() (uint, error)
- func (h Handle) LinkedLTOIR(ltoir uintptr) error
- func (h Handle) LinkedLTOIRSize() (uint, error)
- func (h Handle) LinkedPtx() ([]byte, error)
- func (h Handle) LinkedPtxSize() (uint, error)
- type InputType
- type LibraryAttempt
- type LibraryConflictError
- type LibraryError
- type Result
- type SymbolError
- type VersionMismatchError
Examples ¶
Constants ¶
const ( FlagO0 = "-O0" FlagO3 = "-O3" FlagXPTXAS = "-Xptxas" FlagArch = "-arch" FlagDeviceStackProtector = "-device-stack-protector" FlagFma = "-fma" FlagFtz = "-ftz" FlagG = "-g" FlagJumpTableDensity = "-jump-table-density" FlagKernelsUsed = "-kernels-used" FlagLineinfo = "-lineinfo" FlagLTO = "-lto" FlagMaxrregcount = "-maxrregcount" FlagNoCache = "-no-cache" FlagOptimizeUnusedVariables = "-optimize-unused-variables" FlagPrecDiv = "-prec-div" FlagPrecSqrt = "-prec-sqrt" FlagPTX = "-ptx" FlagR = "-r" FlagSplitCompile = "-split-compile" FlagSplitCompileExtended = "-split-compile-extended" FlagTime = "-time" FlagVariablesUsed = "-variables-used" FlagVerbose = "-verbose" )
nvJitLink option names. Values are passed as -name=value.
Variables ¶
This section is empty.
Functions ¶
func BoundSymbol ¶
BoundSymbol returns the symbol the loaded library bound for the C function name, loading the library first if necessary, or "" if none bound. It answers for the functions that bind the first of several symbols the library exports: BoundSymbol("nvJitLinkAddData") returns "__nvJitLinkAddData_13_5" when the library exports it, and an older spelling otherwise. It returns "" for any other name.
func Close ¶
func Close() error
Close unloads the library and clears all bound function pointers.
The function pointers are package-level state, so Close must not be called concurrently with any other call into this package: doing so is a use-after-free. It is intended for test teardown, not for reclaiming a live library.
func CompilePTX ¶
CompilePTX compiles PTX to native CUBIN in process using nvJitLink. Arch must name a physical target, such as sm_89 or sm_121a. Options are nvJitLink options; they must not replace the architecture or contain NUL. Info is the compiler info log. Call Version and Path separately for provenance. Compilation requires an installed nvJitLink shared library, but no device context, subprocess, or cgo. The caller must not close the library during compilation. On failure no CUBIN is returned.
Example ¶
package main
import (
"fmt"
"github.com/tmc/lib/nvidia/nvjitlink"
)
func main() {
_, _, err := nvjitlink.CompilePTX(nil, "sm_89")
fmt.Println(err)
}
Output: nvjitlink: empty ptx
func Has ¶
Has reports whether the named C symbol resolved in the loaded library, loading it first if necessary. It returns false if the library failed to load. Use it to gate on capabilities before calling into them.
func HasAddData ¶
func HasAddData() bool
HasAddData reports whether nvJitLinkAddData resolved in the loaded library.
It resolves as the first of __nvJitLinkAddData_13_5, __nvJitLinkAddData_13_4, __nvJitLinkAddData_13_3, __nvJitLinkAddData_13_2, __nvJitLinkAddData_13_1, __nvJitLinkAddData_13_0, __nvJitLinkAddData_12_9, __nvJitLinkAddData_12_8, __nvJitLinkAddData_12_6, __nvJitLinkAddData_12_5, __nvJitLinkAddData_12_4, __nvJitLinkAddData_12_3, __nvJitLinkAddData_12_2 that the library exports, or else as the unversioned nvJitLinkAddData, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasAddFile ¶
func HasAddFile() bool
HasAddFile reports whether nvJitLinkAddFile resolved in the loaded library.
It resolves as the first of __nvJitLinkAddFile_13_5, __nvJitLinkAddFile_13_4, __nvJitLinkAddFile_13_3, __nvJitLinkAddFile_13_2, __nvJitLinkAddFile_13_1, __nvJitLinkAddFile_13_0, __nvJitLinkAddFile_12_9, __nvJitLinkAddFile_12_8, __nvJitLinkAddFile_12_6, __nvJitLinkAddFile_12_5, __nvJitLinkAddFile_12_4, __nvJitLinkAddFile_12_3, __nvJitLinkAddFile_12_2 that the library exports, or else as the unversioned nvJitLinkAddFile, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasComplete ¶
func HasComplete() bool
HasComplete reports whether nvJitLinkComplete resolved in the loaded library.
It resolves as the first of __nvJitLinkComplete_13_5, __nvJitLinkComplete_13_4, __nvJitLinkComplete_13_3, __nvJitLinkComplete_13_2, __nvJitLinkComplete_13_1, __nvJitLinkComplete_13_0, __nvJitLinkComplete_12_9, __nvJitLinkComplete_12_8, __nvJitLinkComplete_12_6, __nvJitLinkComplete_12_5, __nvJitLinkComplete_12_4, __nvJitLinkComplete_12_3, __nvJitLinkComplete_12_2 that the library exports, or else as the unversioned nvJitLinkComplete, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasCreate ¶
func HasCreate() bool
HasCreate reports whether nvJitLinkCreate resolved in the loaded library.
It resolves as the first of __nvJitLinkCreate_13_5, __nvJitLinkCreate_13_4, __nvJitLinkCreate_13_3, __nvJitLinkCreate_13_2, __nvJitLinkCreate_13_1, __nvJitLinkCreate_13_0, __nvJitLinkCreate_12_9, __nvJitLinkCreate_12_8, __nvJitLinkCreate_12_6, __nvJitLinkCreate_12_5, __nvJitLinkCreate_12_4, __nvJitLinkCreate_12_3, __nvJitLinkCreate_12_2 that the library exports, or else as the unversioned nvJitLinkCreate, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasDestroy ¶
func HasDestroy() bool
HasDestroy reports whether nvJitLinkDestroy resolved in the loaded library.
It resolves as the first of __nvJitLinkDestroy_13_5, __nvJitLinkDestroy_13_4, __nvJitLinkDestroy_13_3, __nvJitLinkDestroy_13_2, __nvJitLinkDestroy_13_1, __nvJitLinkDestroy_13_0, __nvJitLinkDestroy_12_9, __nvJitLinkDestroy_12_8, __nvJitLinkDestroy_12_6, __nvJitLinkDestroy_12_5, __nvJitLinkDestroy_12_4, __nvJitLinkDestroy_12_3, __nvJitLinkDestroy_12_2 that the library exports, or else as the unversioned nvJitLinkDestroy, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetErrorLog ¶
func HasGetErrorLog() bool
HasGetErrorLog reports whether nvJitLinkGetErrorLog resolved in the loaded library.
It resolves as the first of __nvJitLinkGetErrorLog_13_5, __nvJitLinkGetErrorLog_13_4, __nvJitLinkGetErrorLog_13_3, __nvJitLinkGetErrorLog_13_2, __nvJitLinkGetErrorLog_13_1, __nvJitLinkGetErrorLog_13_0, __nvJitLinkGetErrorLog_12_9, __nvJitLinkGetErrorLog_12_8, __nvJitLinkGetErrorLog_12_6, __nvJitLinkGetErrorLog_12_5, __nvJitLinkGetErrorLog_12_4, __nvJitLinkGetErrorLog_12_3, __nvJitLinkGetErrorLog_12_2 that the library exports, or else as the unversioned nvJitLinkGetErrorLog, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetErrorLogSize ¶
func HasGetErrorLogSize() bool
HasGetErrorLogSize reports whether nvJitLinkGetErrorLogSize resolved in the loaded library.
It resolves as the first of __nvJitLinkGetErrorLogSize_13_5, __nvJitLinkGetErrorLogSize_13_4, __nvJitLinkGetErrorLogSize_13_3, __nvJitLinkGetErrorLogSize_13_2, __nvJitLinkGetErrorLogSize_13_1, __nvJitLinkGetErrorLogSize_13_0, __nvJitLinkGetErrorLogSize_12_9, __nvJitLinkGetErrorLogSize_12_8, __nvJitLinkGetErrorLogSize_12_6, __nvJitLinkGetErrorLogSize_12_5, __nvJitLinkGetErrorLogSize_12_4, __nvJitLinkGetErrorLogSize_12_3, __nvJitLinkGetErrorLogSize_12_2 that the library exports, or else as the unversioned nvJitLinkGetErrorLogSize, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetInfoLog ¶
func HasGetInfoLog() bool
HasGetInfoLog reports whether nvJitLinkGetInfoLog resolved in the loaded library.
It resolves as the first of __nvJitLinkGetInfoLog_13_5, __nvJitLinkGetInfoLog_13_4, __nvJitLinkGetInfoLog_13_3, __nvJitLinkGetInfoLog_13_2, __nvJitLinkGetInfoLog_13_1, __nvJitLinkGetInfoLog_13_0, __nvJitLinkGetInfoLog_12_9, __nvJitLinkGetInfoLog_12_8, __nvJitLinkGetInfoLog_12_6, __nvJitLinkGetInfoLog_12_5, __nvJitLinkGetInfoLog_12_4, __nvJitLinkGetInfoLog_12_3, __nvJitLinkGetInfoLog_12_2 that the library exports, or else as the unversioned nvJitLinkGetInfoLog, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetInfoLogSize ¶
func HasGetInfoLogSize() bool
HasGetInfoLogSize reports whether nvJitLinkGetInfoLogSize resolved in the loaded library.
It resolves as the first of __nvJitLinkGetInfoLogSize_13_5, __nvJitLinkGetInfoLogSize_13_4, __nvJitLinkGetInfoLogSize_13_3, __nvJitLinkGetInfoLogSize_13_2, __nvJitLinkGetInfoLogSize_13_1, __nvJitLinkGetInfoLogSize_13_0, __nvJitLinkGetInfoLogSize_12_9, __nvJitLinkGetInfoLogSize_12_8, __nvJitLinkGetInfoLogSize_12_6, __nvJitLinkGetInfoLogSize_12_5, __nvJitLinkGetInfoLogSize_12_4, __nvJitLinkGetInfoLogSize_12_3, __nvJitLinkGetInfoLogSize_12_2 that the library exports, or else as the unversioned nvJitLinkGetInfoLogSize, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedCubin ¶
func HasGetLinkedCubin() bool
HasGetLinkedCubin reports whether nvJitLinkGetLinkedCubin resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedCubin_13_5, __nvJitLinkGetLinkedCubin_13_4, __nvJitLinkGetLinkedCubin_13_3, __nvJitLinkGetLinkedCubin_13_2, __nvJitLinkGetLinkedCubin_13_1, __nvJitLinkGetLinkedCubin_13_0, __nvJitLinkGetLinkedCubin_12_9, __nvJitLinkGetLinkedCubin_12_8, __nvJitLinkGetLinkedCubin_12_6, __nvJitLinkGetLinkedCubin_12_5, __nvJitLinkGetLinkedCubin_12_4, __nvJitLinkGetLinkedCubin_12_3, __nvJitLinkGetLinkedCubin_12_2 that the library exports, or else as the unversioned nvJitLinkGetLinkedCubin, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedCubinSize ¶
func HasGetLinkedCubinSize() bool
HasGetLinkedCubinSize reports whether nvJitLinkGetLinkedCubinSize resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedCubinSize_13_5, __nvJitLinkGetLinkedCubinSize_13_4, __nvJitLinkGetLinkedCubinSize_13_3, __nvJitLinkGetLinkedCubinSize_13_2, __nvJitLinkGetLinkedCubinSize_13_1, __nvJitLinkGetLinkedCubinSize_13_0, __nvJitLinkGetLinkedCubinSize_12_9, __nvJitLinkGetLinkedCubinSize_12_8, __nvJitLinkGetLinkedCubinSize_12_6, __nvJitLinkGetLinkedCubinSize_12_5, __nvJitLinkGetLinkedCubinSize_12_4, __nvJitLinkGetLinkedCubinSize_12_3, __nvJitLinkGetLinkedCubinSize_12_2 that the library exports, or else as the unversioned nvJitLinkGetLinkedCubinSize, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedLTOIR ¶
func HasGetLinkedLTOIR() bool
HasGetLinkedLTOIR reports whether nvJitLinkGetLinkedLTOIR resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedLTOIR_13_5, __nvJitLinkGetLinkedLTOIR_13_4, __nvJitLinkGetLinkedLTOIR_13_3, __nvJitLinkGetLinkedLTOIR_13_2, __nvJitLinkGetLinkedLTOIR_13_1, __nvJitLinkGetLinkedLTOIR_13_0 that the library exports, or else as the unversioned nvJitLinkGetLinkedLTOIR, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedLTOIRSize ¶
func HasGetLinkedLTOIRSize() bool
HasGetLinkedLTOIRSize reports whether nvJitLinkGetLinkedLTOIRSize resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedLTOIRSize_13_5, __nvJitLinkGetLinkedLTOIRSize_13_4, __nvJitLinkGetLinkedLTOIRSize_13_3, __nvJitLinkGetLinkedLTOIRSize_13_2, __nvJitLinkGetLinkedLTOIRSize_13_1, __nvJitLinkGetLinkedLTOIRSize_13_0 that the library exports, or else as the unversioned nvJitLinkGetLinkedLTOIRSize, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedPtx ¶
func HasGetLinkedPtx() bool
HasGetLinkedPtx reports whether nvJitLinkGetLinkedPtx resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedPtx_13_5, __nvJitLinkGetLinkedPtx_13_4, __nvJitLinkGetLinkedPtx_13_3, __nvJitLinkGetLinkedPtx_13_2, __nvJitLinkGetLinkedPtx_13_1, __nvJitLinkGetLinkedPtx_13_0, __nvJitLinkGetLinkedPtx_12_9, __nvJitLinkGetLinkedPtx_12_8, __nvJitLinkGetLinkedPtx_12_6, __nvJitLinkGetLinkedPtx_12_5, __nvJitLinkGetLinkedPtx_12_4, __nvJitLinkGetLinkedPtx_12_3, __nvJitLinkGetLinkedPtx_12_2 that the library exports, or else as the unversioned nvJitLinkGetLinkedPtx, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasGetLinkedPtxSize ¶
func HasGetLinkedPtxSize() bool
HasGetLinkedPtxSize reports whether nvJitLinkGetLinkedPtxSize resolved in the loaded library.
It resolves as the first of __nvJitLinkGetLinkedPtxSize_13_5, __nvJitLinkGetLinkedPtxSize_13_4, __nvJitLinkGetLinkedPtxSize_13_3, __nvJitLinkGetLinkedPtxSize_13_2, __nvJitLinkGetLinkedPtxSize_13_1, __nvJitLinkGetLinkedPtxSize_13_0, __nvJitLinkGetLinkedPtxSize_12_9, __nvJitLinkGetLinkedPtxSize_12_8, __nvJitLinkGetLinkedPtxSize_12_6, __nvJitLinkGetLinkedPtxSize_12_5, __nvJitLinkGetLinkedPtxSize_12_4, __nvJitLinkGetLinkedPtxSize_12_3, __nvJitLinkGetLinkedPtxSize_12_2 that the library exports, or else as the unversioned nvJitLinkGetLinkedPtxSize, which resolves only in a library whose version was verified. BoundSymbol reports which.
func HasVersion ¶
func HasVersion() bool
HasVersion reports whether nvJitLinkVersion resolved in the loaded library.
func Load ¶
Load opens the shared library from path, or from the default search list when path is empty, and binds all symbols. Callers that need to direct loading should call Load before any other function; otherwise the first call loads from the default search list.
Load is idempotent: calling it again with the same path, or with an empty path, returns nil. Calling it with a different path after a successful load returns *LibraryConflictError rather than replacing the library. After a failed load, Load retries.
func Loaded ¶
func Loaded() bool
Loaded reports whether the library is currently loaded. It does not trigger a load.
func Path ¶
func Path() string
Path returns the path or name the loaded library was opened from, or the empty string if no library is loaded.
func ValidateOption ¶
ValidateOption checks a documented nvJitLink option before native linking.
Types ¶
type BindFailure ¶
BindFailure names a symbol the loaded library exports but that could not be bound, and why.
func BindFailures ¶
func BindFailures() []BindFailure
BindFailures returns the symbols the loaded library exports that could not be bound, sorted by symbol name, or nil if every exported symbol bound. Calling one of these reports *SymbolError with the same Err.
A load that reports no error can still leave symbols unbound: the library is fine and the signatures are not representable here. Call this after Load to find that out at once rather than one call site at a time. It does not trigger a load, and returns nil if none has happened.
type CallError ¶
CallError reports that a library call returned a failure result.
Unwrap returns Result, so errors.Is(err, c) reports whether the call returned the Result constant c, and errors.As(err, &r) with r of type Result recovers the code.
type Handle ¶
type Handle uintptr
Handle is an opaque handle for nvJitLinkHandle.
func Create ¶
Create wraps nvJitLinkCreate.
Wraps nvJitLinkCreate, bound to the first of __nvJitLinkCreate_13_5, __nvJitLinkCreate_13_4, __nvJitLinkCreate_13_3, __nvJitLinkCreate_13_2, __nvJitLinkCreate_13_1, __nvJitLinkCreate_13_0, __nvJitLinkCreate_12_9, __nvJitLinkCreate_12_8, __nvJitLinkCreate_12_6, __nvJitLinkCreate_12_5, __nvJitLinkCreate_12_4, __nvJitLinkCreate_12_3, __nvJitLinkCreate_12_2 that the library exports, or else to nvJitLinkCreate in a library whose version was verified.
func (Handle) AddData ¶
AddData wraps nvJitLinkAddData.
Wraps nvJitLinkAddData, bound to the first of __nvJitLinkAddData_13_5, __nvJitLinkAddData_13_4, __nvJitLinkAddData_13_3, __nvJitLinkAddData_13_2, __nvJitLinkAddData_13_1, __nvJitLinkAddData_13_0, __nvJitLinkAddData_12_9, __nvJitLinkAddData_12_8, __nvJitLinkAddData_12_6, __nvJitLinkAddData_12_5, __nvJitLinkAddData_12_4, __nvJitLinkAddData_12_3, __nvJitLinkAddData_12_2 that the library exports, or else to nvJitLinkAddData in a library whose version was verified.
func (Handle) AddFile ¶
AddFile wraps nvJitLinkAddFile.
Wraps nvJitLinkAddFile, bound to the first of __nvJitLinkAddFile_13_5, __nvJitLinkAddFile_13_4, __nvJitLinkAddFile_13_3, __nvJitLinkAddFile_13_2, __nvJitLinkAddFile_13_1, __nvJitLinkAddFile_13_0, __nvJitLinkAddFile_12_9, __nvJitLinkAddFile_12_8, __nvJitLinkAddFile_12_6, __nvJitLinkAddFile_12_5, __nvJitLinkAddFile_12_4, __nvJitLinkAddFile_12_3, __nvJitLinkAddFile_12_2 that the library exports, or else to nvJitLinkAddFile in a library whose version was verified.
func (Handle) Complete ¶
Complete wraps nvJitLinkComplete.
Wraps nvJitLinkComplete, bound to the first of __nvJitLinkComplete_13_5, __nvJitLinkComplete_13_4, __nvJitLinkComplete_13_3, __nvJitLinkComplete_13_2, __nvJitLinkComplete_13_1, __nvJitLinkComplete_13_0, __nvJitLinkComplete_12_9, __nvJitLinkComplete_12_8, __nvJitLinkComplete_12_6, __nvJitLinkComplete_12_5, __nvJitLinkComplete_12_4, __nvJitLinkComplete_12_3, __nvJitLinkComplete_12_2 that the library exports, or else to nvJitLinkComplete in a library whose version was verified.
func (*Handle) Destroy ¶
Destroy wraps nvJitLinkDestroy.
It is not named Close because it takes a pointer to the handle.
Wraps nvJitLinkDestroy, bound to the first of __nvJitLinkDestroy_13_5, __nvJitLinkDestroy_13_4, __nvJitLinkDestroy_13_3, __nvJitLinkDestroy_13_2, __nvJitLinkDestroy_13_1, __nvJitLinkDestroy_13_0, __nvJitLinkDestroy_12_9, __nvJitLinkDestroy_12_8, __nvJitLinkDestroy_12_6, __nvJitLinkDestroy_12_5, __nvJitLinkDestroy_12_4, __nvJitLinkDestroy_12_3, __nvJitLinkDestroy_12_2 that the library exports, or else to nvJitLinkDestroy in a library whose version was verified.
func (Handle) ErrorLog ¶
ErrorLog wraps nvJitLinkGetErrorLog.
Wraps nvJitLinkGetErrorLog, bound to the first of __nvJitLinkGetErrorLog_13_5, __nvJitLinkGetErrorLog_13_4, __nvJitLinkGetErrorLog_13_3, __nvJitLinkGetErrorLog_13_2, __nvJitLinkGetErrorLog_13_1, __nvJitLinkGetErrorLog_13_0, __nvJitLinkGetErrorLog_12_9, __nvJitLinkGetErrorLog_12_8, __nvJitLinkGetErrorLog_12_6, __nvJitLinkGetErrorLog_12_5, __nvJitLinkGetErrorLog_12_4, __nvJitLinkGetErrorLog_12_3, __nvJitLinkGetErrorLog_12_2 that the library exports, or else to nvJitLinkGetErrorLog in a library whose version was verified.
func (Handle) ErrorLogSize ¶
ErrorLogSize wraps nvJitLinkGetErrorLogSize.
The size counts the terminating NUL that Handle.ErrorLog drops, so it is one more than the length of that result.
Wraps nvJitLinkGetErrorLogSize, bound to the first of __nvJitLinkGetErrorLogSize_13_5, __nvJitLinkGetErrorLogSize_13_4, __nvJitLinkGetErrorLogSize_13_3, __nvJitLinkGetErrorLogSize_13_2, __nvJitLinkGetErrorLogSize_13_1, __nvJitLinkGetErrorLogSize_13_0, __nvJitLinkGetErrorLogSize_12_9, __nvJitLinkGetErrorLogSize_12_8, __nvJitLinkGetErrorLogSize_12_6, __nvJitLinkGetErrorLogSize_12_5, __nvJitLinkGetErrorLogSize_12_4, __nvJitLinkGetErrorLogSize_12_3, __nvJitLinkGetErrorLogSize_12_2 that the library exports, or else to nvJitLinkGetErrorLogSize in a library whose version was verified.
func (Handle) InfoLog ¶
InfoLog wraps nvJitLinkGetInfoLog.
Wraps nvJitLinkGetInfoLog, bound to the first of __nvJitLinkGetInfoLog_13_5, __nvJitLinkGetInfoLog_13_4, __nvJitLinkGetInfoLog_13_3, __nvJitLinkGetInfoLog_13_2, __nvJitLinkGetInfoLog_13_1, __nvJitLinkGetInfoLog_13_0, __nvJitLinkGetInfoLog_12_9, __nvJitLinkGetInfoLog_12_8, __nvJitLinkGetInfoLog_12_6, __nvJitLinkGetInfoLog_12_5, __nvJitLinkGetInfoLog_12_4, __nvJitLinkGetInfoLog_12_3, __nvJitLinkGetInfoLog_12_2 that the library exports, or else to nvJitLinkGetInfoLog in a library whose version was verified.
func (Handle) InfoLogSize ¶
InfoLogSize wraps nvJitLinkGetInfoLogSize.
The size counts the terminating NUL that Handle.InfoLog drops, so it is one more than the length of that result.
Wraps nvJitLinkGetInfoLogSize, bound to the first of __nvJitLinkGetInfoLogSize_13_5, __nvJitLinkGetInfoLogSize_13_4, __nvJitLinkGetInfoLogSize_13_3, __nvJitLinkGetInfoLogSize_13_2, __nvJitLinkGetInfoLogSize_13_1, __nvJitLinkGetInfoLogSize_13_0, __nvJitLinkGetInfoLogSize_12_9, __nvJitLinkGetInfoLogSize_12_8, __nvJitLinkGetInfoLogSize_12_6, __nvJitLinkGetInfoLogSize_12_5, __nvJitLinkGetInfoLogSize_12_4, __nvJitLinkGetInfoLogSize_12_3, __nvJitLinkGetInfoLogSize_12_2 that the library exports, or else to nvJitLinkGetInfoLogSize in a library whose version was verified.
func (Handle) LinkedCubin ¶
LinkedCubin wraps nvJitLinkGetLinkedCubin.
Wraps nvJitLinkGetLinkedCubin, bound to the first of __nvJitLinkGetLinkedCubin_13_5, __nvJitLinkGetLinkedCubin_13_4, __nvJitLinkGetLinkedCubin_13_3, __nvJitLinkGetLinkedCubin_13_2, __nvJitLinkGetLinkedCubin_13_1, __nvJitLinkGetLinkedCubin_13_0, __nvJitLinkGetLinkedCubin_12_9, __nvJitLinkGetLinkedCubin_12_8, __nvJitLinkGetLinkedCubin_12_6, __nvJitLinkGetLinkedCubin_12_5, __nvJitLinkGetLinkedCubin_12_4, __nvJitLinkGetLinkedCubin_12_3, __nvJitLinkGetLinkedCubin_12_2 that the library exports, or else to nvJitLinkGetLinkedCubin in a library whose version was verified.
func (Handle) LinkedCubinSize ¶
LinkedCubinSize wraps nvJitLinkGetLinkedCubinSize.
Wraps nvJitLinkGetLinkedCubinSize, bound to the first of __nvJitLinkGetLinkedCubinSize_13_5, __nvJitLinkGetLinkedCubinSize_13_4, __nvJitLinkGetLinkedCubinSize_13_3, __nvJitLinkGetLinkedCubinSize_13_2, __nvJitLinkGetLinkedCubinSize_13_1, __nvJitLinkGetLinkedCubinSize_13_0, __nvJitLinkGetLinkedCubinSize_12_9, __nvJitLinkGetLinkedCubinSize_12_8, __nvJitLinkGetLinkedCubinSize_12_6, __nvJitLinkGetLinkedCubinSize_12_5, __nvJitLinkGetLinkedCubinSize_12_4, __nvJitLinkGetLinkedCubinSize_12_3, __nvJitLinkGetLinkedCubinSize_12_2 that the library exports, or else to nvJitLinkGetLinkedCubinSize in a library whose version was verified.
func (Handle) LinkedLTOIR ¶
LinkedLTOIR wraps nvJitLinkGetLinkedLTOIR.
Wraps nvJitLinkGetLinkedLTOIR, bound to the first of __nvJitLinkGetLinkedLTOIR_13_5, __nvJitLinkGetLinkedLTOIR_13_4, __nvJitLinkGetLinkedLTOIR_13_3, __nvJitLinkGetLinkedLTOIR_13_2, __nvJitLinkGetLinkedLTOIR_13_1, __nvJitLinkGetLinkedLTOIR_13_0 that the library exports, or else to nvJitLinkGetLinkedLTOIR in a library whose version was verified.
func (Handle) LinkedLTOIRSize ¶
LinkedLTOIRSize wraps nvJitLinkGetLinkedLTOIRSize.
Wraps nvJitLinkGetLinkedLTOIRSize, bound to the first of __nvJitLinkGetLinkedLTOIRSize_13_5, __nvJitLinkGetLinkedLTOIRSize_13_4, __nvJitLinkGetLinkedLTOIRSize_13_3, __nvJitLinkGetLinkedLTOIRSize_13_2, __nvJitLinkGetLinkedLTOIRSize_13_1, __nvJitLinkGetLinkedLTOIRSize_13_0 that the library exports, or else to nvJitLinkGetLinkedLTOIRSize in a library whose version was verified.
func (Handle) LinkedPtx ¶
LinkedPtx wraps nvJitLinkGetLinkedPtx.
The result does not include the C string's terminating NUL.
Wraps nvJitLinkGetLinkedPtx, bound to the first of __nvJitLinkGetLinkedPtx_13_5, __nvJitLinkGetLinkedPtx_13_4, __nvJitLinkGetLinkedPtx_13_3, __nvJitLinkGetLinkedPtx_13_2, __nvJitLinkGetLinkedPtx_13_1, __nvJitLinkGetLinkedPtx_13_0, __nvJitLinkGetLinkedPtx_12_9, __nvJitLinkGetLinkedPtx_12_8, __nvJitLinkGetLinkedPtx_12_6, __nvJitLinkGetLinkedPtx_12_5, __nvJitLinkGetLinkedPtx_12_4, __nvJitLinkGetLinkedPtx_12_3, __nvJitLinkGetLinkedPtx_12_2 that the library exports, or else to nvJitLinkGetLinkedPtx in a library whose version was verified.
func (Handle) LinkedPtxSize ¶
LinkedPtxSize wraps nvJitLinkGetLinkedPtxSize.
The size counts the terminating NUL that Handle.LinkedPtx drops, so it is one more than the length of that result.
Wraps nvJitLinkGetLinkedPtxSize, bound to the first of __nvJitLinkGetLinkedPtxSize_13_5, __nvJitLinkGetLinkedPtxSize_13_4, __nvJitLinkGetLinkedPtxSize_13_3, __nvJitLinkGetLinkedPtxSize_13_2, __nvJitLinkGetLinkedPtxSize_13_1, __nvJitLinkGetLinkedPtxSize_13_0, __nvJitLinkGetLinkedPtxSize_12_9, __nvJitLinkGetLinkedPtxSize_12_8, __nvJitLinkGetLinkedPtxSize_12_6, __nvJitLinkGetLinkedPtxSize_12_5, __nvJitLinkGetLinkedPtxSize_12_4, __nvJitLinkGetLinkedPtxSize_12_3, __nvJitLinkGetLinkedPtxSize_12_2 that the library exports, or else to nvJitLinkGetLinkedPtxSize in a library whose version was verified.
type InputType ¶
type InputType int32
InputType defines the kind of inputs that can be passed to nvJitLinkAdd* APIs.
const ( InputNone InputType = 0 // Error Type InputCubin InputType = 1 // For CUDA Binaries InputPtx InputType = 2 // For PTX InputLtoir InputType = 3 // For LTO-IR InputFatbin InputType = 4 // For Fatbin InputObject InputType = 5 // For Host Object InputLibrary InputType = 6 // For Host Library InputIndex InputType = 7 // For Index File InputAny InputType = 10 // Dynamically chooses from the valid types )
type LibraryAttempt ¶
LibraryAttempt records one failed attempt to open the shared library.
type LibraryConflictError ¶
type LibraryConflictError struct {
Loaded string
Requested string
// Implicit reports that the loaded library was opened lazily and no
// successful Load has since acknowledged it. A
// caller that sees this called some
// other function first, and that call took the default search list.
Implicit bool
}
LibraryConflictError reports a Load call naming a different library than the one already loaded. Only one library is loaded per process.
func (*LibraryConflictError) Error ¶
func (e *LibraryConflictError) Error() string
Error reports the conflicting library paths, and whether the library that is already loaded got there without a Load call.
type LibraryError ¶
type LibraryError struct {
Library string
Env string
Path string
Attempts []LibraryAttempt
Hint string
}
LibraryError reports that libnvJitLink could not be opened. Attempts lists every name tried in order. Path is set when an explicit path, from Load or NVJITLINK_LIB_PATH, was requested and failed. Hint reports pkg-config discovery results and query failures, when discovery ran.
func (*LibraryError) Error ¶
func (e *LibraryError) Error() string
Error describes the library load attempts and their errors.
func (*LibraryError) Unwrap ¶
func (e *LibraryError) Unwrap() []error
Unwrap returns the error from each attempt.
type Result ¶
type Result int32
Result represents a nvJitLink API error code (nvJitLinkResult).
const ( Success Result = 0 ErrUnrecognizedOption Result = 1 // Unrecognized Option ErrMissingArch Result = 2 // Option `-arch=sm_NN` not specified ErrInvalidInput Result = 3 // Invalid Input ErrPtxCompile Result = 4 // Issue during PTX Compilation ErrNvvmCompile Result = 5 // Issue during NVVM Compilation ErrInternal Result = 6 // Internal Error ErrThreadpool Result = 7 // Issue with Thread Pool ErrUnrecognizedInput Result = 8 // Unrecognized Input ErrFinalize Result = 9 // Finalizer Error ErrNullInput Result = 10 // Null Input ErrIncompatibleOptions Result = 11 // Incompatible Options ErrIncorrectInputType Result = 12 // Incorrect Input Type ErrArchMismatch Result = 13 // Arch Mismatch ErrOutdatedLibrary Result = 14 // Outdated Library ErrMissingFatbin Result = 15 // Missing Fatbin ErrUnrecognizedArch Result = 16 // Unrecognized -arch value ErrUnsupportedArch Result = 17 // Unsupported -arch value ErrLtoNotEnabled Result = 18 // Requires -lto )
nvJitLink error codes from nvJitLink.h.
type SymbolError ¶
SymbolError reports that a symbol is not callable.
Err distinguishes the two ways that happens. A nil Err means the loaded library does not export the symbol, which is what an installation older than the symbol looks like. A non-nil Err means the library does export it and the binding itself failed; the library is not at fault.
func (*SymbolError) Error ¶
func (e *SymbolError) Error() string
Error reports the uncallable library symbol and, when the symbol was present but could not be bound, why.
func (*SymbolError) Unwrap ¶
func (e *SymbolError) Unwrap() error
Unwrap returns the reason the symbol could not be bound, or nil when the loaded library does not export it.
type VersionMismatchError ¶
type VersionMismatchError struct {
Path string // the library that was opened
Want int // major version these bindings were generated for
Got int // major version the library reports
Raw int // the version value the library reported, undecoded
}
VersionMismatchError reports that the shared library that opened is not from the version train nvjitlink was generated for. dlsym matches on name alone, so a library from a neighbouring train opens and resolves nearly every symbol; asking it its own version is what tells the two apart.
func (*VersionMismatchError) Error ¶
func (e *VersionMismatchError) Error() string
Error reports which library was opened and the two majors that disagree.
A decoder is only a decoder for the version schemes it was measured against, and a library from a train that predates the scheme can report a value it does not decode. Naming a major of 0 in that case would attribute to the library a claim it never made, so the raw value is reported instead.