Source/Packages

Platform.RunPod.Nvidia.SM86

packages/hardware/platforms/linux-nvidia/src/Platform/RunPod/Nvidia/SM86.alpha

285 lines35 declarations10.0 KiBSHA-256 a3abc5150f8c

Complete file · line 284

SM86.alpha

Definition view
1module Platform.RunPod.Nvidia.SM86
2
3import Accelerator.SM86.Capability
4import Model.Config
5import Model.Parameter
6import Model.Word32
7import Model.Word64
8import Platform.Linux.Nvidia.Compatibility
9import Platform.Linux.Nvidia.Memory.ABI
10import Std.List
11import Std.Natural
12import Std.Word
13
14-- A concrete target profile is stricter than generic SM86 capability
15-- admission.  It binds an artifact to one exact provider-visible product while
16-- leaving model and learner packages unaware of any card name.
17family RunPodSM86TargetProfile : Type 0
18constructor RunPodSM86TargetProfileValue
19field unrestricted runPodSM86TargetIdentityValue : Bytes
20field unrestricted runPodSM86ProductIdentityValue : Bytes
21field unrestricted runPodSM86ComputeMajorValue : Nat
22field unrestricted runPodSM86ComputeMinorValue : Nat
23field unrestricted runPodSM86TotalVideoMemoryValue : ModelWord64
24-- what the driver keeps of it before any process allocates (nvidia-smi -q
25-- -d MEMORY, "Reserved"): a process can allocate total - reserved at most
26field unrestricted runPodSM86ReservedVideoMemoryValue : ModelWord64
27
28end-family
29
30def runPodRTX3070TargetIdentity : Bytes =
31  b"runpod-nvidia-geforce-rtx3070-sm86"
32
33def runPodRTX3070ProductIdentity : Bytes =
34  b"NVIDIA GeForce RTX 3070"
35
36def runPodRTX3070TotalVideoMemory : StdU64 =
37  0x0000_0002_0000_0000
38
39-- 352 MiB, measured on a RunPod RTX 3070, driver 580.126.20, 2026-10-04
40def runPodRTX3070ReservedVideoMemory : StdU64 =
41  0x0000_0000_1600_0000
42
43def runPodRTX3070TargetProfile : RunPodSM86TargetProfile =
44  (record
45    RunPodSM86TargetProfile
46    (runPodSM86TargetIdentityValue = runPodRTX3070TargetIdentity)
47    (runPodSM86ProductIdentityValue = runPodRTX3070ProductIdentity)
48    (runPodSM86ComputeMajorValue = 8)
49    (runPodSM86ComputeMinorValue = 6)
50    (runPodSM86TotalVideoMemoryValue = runPodRTX3070TotalVideoMemory)
51    (runPodSM86ReservedVideoMemoryValue = runPodRTX3070ReservedVideoMemory))
52
53def runPodRTX3090TargetIdentity : Bytes =
54  b"runpod-nvidia-geforce-rtx3090-sm86"
55
56def runPodRTX3090ProductIdentity : Bytes =
57  b"NVIDIA GeForce RTX 3090"
58
59def runPodRTX3090TotalVideoMemory : StdU64 =
60  0x0000_0006_0000_0000
61
62-- 452 MiB, measured on the RunPod RTX 3090, driver 580.126.20, 2026-10-04
63def runPodRTX3090ReservedVideoMemory : StdU64 =
64  0x0000_0000_1C40_0000
65
66def runPodRTX3090TargetProfile : RunPodSM86TargetProfile =
67  (record
68    RunPodSM86TargetProfile
69    (runPodSM86TargetIdentityValue = runPodRTX3090TargetIdentity)
70    (runPodSM86ProductIdentityValue = runPodRTX3090ProductIdentity)
71    (runPodSM86ComputeMajorValue = 8)
72    (runPodSM86ComputeMinorValue = 6)
73    (runPodSM86TotalVideoMemoryValue = runPodRTX3090TotalVideoMemory)
74    (runPodSM86ReservedVideoMemoryValue = runPodRTX3090ReservedVideoMemory))
75
76-- Ampere command-stream facts belong to the exact target package.  Systems
77-- consume these values when late realization derives QMDs and pushbuffers;
78-- they never branch on a card name or copy driver constants.
79def runPodSM86QMDArchitecture : ModelWord32 =
80  134
81
82-- Ampere QMD v0.3 occupies one 256-byte SEND_PCAS slot. This is a target
83-- command-format fact, separate from the number of launches a system emits.
84def runPodSM86QMDSlotBytes : Nat =
85  256
86
87def runPodSM86ComputeClass : ModelWord32 =
88  51136
89
90def runPodSM86SPAVersion : ModelWord32 =
91  2054
92
93def runPodSM86TargetIdentity =
94  (lambda unrestricted profile : RunPodSM86TargetProfile .
95    eliminate
96      RunPodSM86TargetProfile
97      (lambda unrestricted current : RunPodSM86TargetProfile . Bytes)
98      profile
99      (branch
100        RunPodSM86TargetProfileValue
101        targetIdentity
102        productIdentity
103        computeMajor
104        computeMinor
105        totalVideoMemory
106        reservedVideoMemory
107        .
108        targetIdentity))
109
110def runPodSM86TotalVideoMemory =
111  (lambda unrestricted profile : RunPodSM86TargetProfile .
112    eliminate
113      RunPodSM86TargetProfile
114      (lambda unrestricted current : RunPodSM86TargetProfile . ModelWord64)
115      profile
116      (branch
117        RunPodSM86TargetProfileValue
118        targetIdentity
119        productIdentity
120        computeMajor
121        computeMinor
122        totalVideoMemory
123        reservedVideoMemory
124        .
125        totalVideoMemory))
126
127def runPodSM86ReservedVideoMemory =
128  (lambda unrestricted profile : RunPodSM86TargetProfile .
129    eliminate
130      RunPodSM86TargetProfile
131      (lambda unrestricted current : RunPodSM86TargetProfile . ModelWord64)
132      profile
133      (branch
134        RunPodSM86TargetProfileValue
135        targetIdentity
136        productIdentity
137        computeMajor
138        computeMinor
139        totalVideoMemory
140        reservedVideoMemory
141        .
142        reservedVideoMemory))
143
144-- what one process can allocate: total less the driver's reservation
145def runPodSM86UsableVideoMemory =
146  (lambda unrestricted profile : RunPodSM86TargetProfile .
147    naturalSaturatingSubtract
148      (modelWord64Natural (runPodSM86TotalVideoMemory profile))
149      (modelWord64Natural (runPodSM86ReservedVideoMemory profile)))
150
151def runPodSM86ProductIdentity =
152  (lambda unrestricted profile : RunPodSM86TargetProfile .
153    eliminate
154      RunPodSM86TargetProfile
155      (lambda unrestricted current : RunPodSM86TargetProfile . Bytes)
156      profile
157      (branch
158        RunPodSM86TargetProfileValue
159        targetIdentity
160        productIdentity
161        computeMajor
162        computeMinor
163        totalVideoMemory
164        reservedVideoMemory
165        .
166        productIdentity))
167
168-- NV2080_CTRL_CMD_GPU_GET_NAME_STRING uses one fixed 64-byte ASCII field.
169-- The concrete product identity remains readable source text and only the ABI
170-- projection adds its required trailing NUL bytes.
171def runPodSM86ProductIdentityPadded =
172  (lambda unrestricted profile : RunPodSM86TargetProfile .
173    then (bytes-append (runPodSM86ProductIdentity profile))
174      memoryABIZeroBytes
175      (naturalSaturatingSubtract 64)
176      bytes-length
177      runPodSM86ProductIdentity
178      profile)
179
180-- Product matching is a pre-submission guard.  The system-specific generic
181-- SM86 admission remains a second, independent check for memory, addresses,
182-- grid, RM/UVM, command formats, timestamps and absence of fallback.
183def runPodSM86TargetMatches =
184  (lambda unrestricted profile : RunPodSM86TargetProfile .
185    unrestricted observedProductIdentity : Bytes .
186    unrestricted observed : SM86DeviceCapabilities .
187    eliminate
188      RunPodSM86TargetProfile
189      (lambda unrestricted current : RunPodSM86TargetProfile . Nat)
190      profile
191      (branch
192        RunPodSM86TargetProfileValue
193        targetIdentity
194        requiredProductIdentity
195        requiredMajor
196        requiredMinor
197        requiredTotalVideoMemory
198        requiredReservedVideoMemory
199        .
200        eliminate
201          SM86DeviceCapabilities
202          (lambda unrestricted current : SM86DeviceCapabilities . Nat)
203          observed
204          (branch
205            SM86DeviceCapabilitiesValue
206            observedMajor
207            observedMinor
208            observedTotalVideoMemory
209            observedAvailableVideoMemory
210            observedMappedAddressEnd
211            observedMaximumGridX
212            observedUVM
213            observedResourceManager
214            observedQMD
215            observedPushbuffer
216            observedGPFIFO
217            observedTimestamps
218            observedFallbacks
219            .
220            nest naturalAnd
221              (bytes-equal observedProductIdentity requiredProductIdentity)
222              (naturalEqual observedMajor requiredMajor)
223              (naturalEqual observedMinor requiredMinor)
224              (modelWord64Equal observedTotalVideoMemory requiredTotalVideoMemory))))
225
226-- ---- what the cards supply (Platform.Linux.Nvidia.Compatibility) ----
227-- The architecture's, with its source; the rest as the qualified runs on
228-- the card recorded them (`record`: the run's evidence).
229def runPodSM86Architectural =
230  (lambda unrestricted source : Bytes .
231    constructor NvidiaEvidence NvidiaEvidenceArchitectural source)
232
233def runPodSM86Supplies =
234  (lambda unrestricted profile : RunPodSM86TargetProfile . unrestricted record : Bytes .
235    let unrestricted measured =
236      (constructor NvidiaEvidence NvidiaEvidenceMeasured record)
237      in
238      eliminate
239        RunPodSM86TargetProfile
240        (lambda unrestricted current : RunPodSM86TargetProfile . family StdList NvidiaSupply)
241        profile
242        (branch
243          RunPodSM86TargetProfileValue
244          target
245          product
246          major
247          minor
248          memory
249          reserved
250          .
251          then (nvidiaSupply b"instruction-set" (naturalAdd (naturalMultiply 10 major) minor) (runPodSM86Architectural b"NVIDIA Ampere GA10x: compute capability 8.6 (CUDA C++ Programming Guide, compute capabilities)"))
252            (nvidiaSupply
253              b"compute-class"
254              (modelWord32ToNatural runPodSM86ComputeClass)
255              (runPodSM86Architectural b"AMPERE_COMPUTE_B (open-gpu-kernel-modules, clc7c0.h)"))
256            (nvidiaSupply
257              b"registers-per-thread"
258              255
259              (runPodSM86Architectural
260                b"SM86: an 8-bit register operand, R255 the zero register (Accelerator.SM86.Types)"))
261            (nvidiaSupply
262              b"threads-per-block"
263              1024
264              (runPodSM86Architectural b"compute capability 8.6: at most 1024 threads per block"))
265            (nvidiaSupply
266              b"shared-bytes-per-block"
267              49152
268              (runPodSM86Architectural
269                b"compute capability 8.6: 48 KiB of static shared memory per block"))
270            (nvidiaSupply b"driver-branch" (nvidiaCompatibilityTextWord b"580.") measured)
271            (nvidiaSupply b"unified-memory" 1 measured)
272            (nvidiaSupply b"video-memory-bytes" (modelWord64Natural memory) measured)
273            nvidiaNoSupplies))
274
275def runPodRTX3070Record : Bytes =
276  b"tests/observability/import/envelope-rtx3070/README.md"
277
278def runPodRTX3090Record : Bytes =
279  b"tests/observability/import/bob-rtx3090/README.md"
280
281def runPodRTX3070Supplies : (family StdList NvidiaSupply) =
282  (runPodSM86Supplies runPodRTX3070TargetProfile runPodRTX3070Record)
283
284def runPodRTX3090Supplies : (family StdList NvidiaSupply) =
285  (runPodSM86Supplies runPodRTX3090TargetProfile runPodRTX3090Record)

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.