1module Coppelius.Build.Placement
2
3import Compiler.Planning.VA
4import Coppelius.ArenaPlan
5import Coppelius.Build.Graph
6import Hardware.Nvidia.SM86.Command.QMD
7import Hardware.Nvidia.SM86.Command.WholeProgramPlan
8import Platform.Linux.Nvidia.PlanHost
9import Platform.Linux.Nvidia.PlanHostRequest
10import Std.Natural
11
12-- ---- the buffers the plan sizes ----
13-- Placed after the ones the plan itself depends on (Coppelius.ArenaPlan: the
14-- GPFIFO, the staging window, the program region), in the card's address
15-- space and in the process: the semaphores, a slot per submission; the QMD
16-- buffer; and last the pushbuffer, whose extent is its expansion's (the host
17-- learns it from the realization), so nothing is placed by it. The host
18-- side of the arena certificate decides that they are disjoint.
19
20-- one semaphore slot per submission; then the per-launch profile's slots
21-- (NvidiaSubmissionScheduleProfiled: a timestamped release after each
22-- launch, 16 bytes at its QMD ordinal), reserved in every build so that a
23-- profiling build differs from production only in its pushbuffer; to the
24-- page
25def coppeliusProfileOffset : Nat =
26 (naturalMultiply prSemaphoreStride coppeliusSubmissionCount)
27
28def coppeliusProfileSlotBytes : Nat = 16
29
30def coppeliusSemaphoreBytes : Nat =
31 (nvidiaPlanHostRoundUp
32 (naturalAdd coppeliusProfileOffset (naturalMultiply coppeliusProfileSlotBytes coppeliusLaunchCount))
33 nvidiaPlanHostMappingUnit)
34
35-- the plan's submissions, each launch followed by its profile release
36def coppeliusProfiledSubmissionSchedule : (family NvidiaSubmissionSchedule) =
37 (constructor NvidiaSubmissionSchedule NvidiaSubmissionScheduleProfiled
38 coppeliusProfileOffset coppeliusSubmissionSchedule)
39
40-- one GPFIFO entry per submission
41def coppeliusGPFIFOTableBytes : Nat =
42 (naturalMultiply 8 coppeliusSubmissionCount)
43
44-- the QMD table: a record per launch of the plan at the card's record
45-- stride, to the page; parameter blocks the program region cannot hold
46-- spill past it
47def coppeliusQMDTableBytesFor =
48 (lambda unrestricted recordBytes : Nat .
49 (nvidiaPlanHostRoundUp (naturalMultiply coppeliusLaunchCount recordBytes) nvidiaPlanHostMappingUnit))
50
51-- the RTX pairings' (QMD V03)
52def coppeliusQMDTableBytes : Nat =
53 (coppeliusQMDTableBytesFor qmdRecordBytes)
54
55def coppeliusSemaphoreBase : Nat =
56 (vaPlaceAfter coppeliusProgramBase coppeliusSM86CompatProgramBytesNatural coppeliusDeviceSpaceAlignment)
57
58def coppeliusQMDBase : Nat =
59 (vaPlaceAfter coppeliusSemaphoreBase coppeliusSemaphoreBytes coppeliusDeviceSpaceAlignment)
60
61def coppeliusPushbufferBase : Nat =
62 (vaPlaceAfter coppeliusQMDBase coppeliusSM86CompatQMDBytesNatural coppeliusDeviceSpaceAlignment)
63
64def coppeliusHostSemaphores : Nat =
65 (vaPlaceAfter coppeliusHostProgram coppeliusSM86CompatProgramBytesNatural nvidiaPlanHostMappingAlignment)
66
67def coppeliusHostQMD : Nat =
68 (vaPlaceAfter coppeliusHostSemaphores coppeliusSemaphoreBytes nvidiaPlanHostMappingAlignment)
69
70def coppeliusHostPushbuffer : Nat =
71 (vaPlaceAfter coppeliusHostQMD coppeliusSM86CompatQMDBytesNatural nvidiaPlanHostMappingAlignment)
72
73-- the pushbuffer's extent: its expansion, to the mapping unit
74def coppeliusPushbufferBytes =
75 (lambda unrestricted pushExpanded : Nat .
76 (nvidiaPlanHostRoundUp pushExpanded nvidiaPlanHostMappingUnit))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.