Module Sarek_cuda.Cuda_ptx_isa

PTX ISA versions: which one an SM needs and which one a driver accepts.

Cuda_api.Kernel.load_from_ptx rewrites .target to the device's own SM, so .version must follow: PTX ISA 8.0 does not know sm_120 (issue #506). Pure: no libcuda, no device.

type t = int * int

A PTX ISA version, (major, minor); ordered by structural comparison.

val to_string : t -> string
val of_string : string -> t option

of_string "8.7" is Some (8, 7); None on anything else.

val required_version : major:int -> minor:int -> t

The lowest PTX ISA version that admits .target sm_<major><minor>. sm_88 (also what ZLUDA reports), sm_110 and SMs not listed get 9.0, the newest version here; ZLUDA parses it. Pre-Ampere SMs get 7.0.

val driver_max_version : (int * int) -> t option

driver_max_version (major, minor) is the highest PTX ISA the driver's CUDA version (from cuDriverGetVersion, e.g. 13.0) accepts, per the PTX ISA release notes. None when the driver is newer than this table (or older than CUDA 11.8): unknown, so not gated here, and the driver's own error stands.

val check_driver : driver:(int * int) -> required:t -> (unit, string) Stdlib.result

check_driver ~driver ~required is Error msg naming both versions when the driver is known to accept less than required.

val starts_with : prefix:string -> string -> bool
val with_sm_target : major:int -> minor:int -> string -> string

Rewrite .target to sm_<major><minor> and raise .version to at least required_version for that SM. A .version already at or above it, or one that does not parse, is left alone: the version is never lowered.

val declared_version : string -> t option

The .version the PTX declares, None if absent or unparseable.