Source/Systems

Coppelius.ArenaPlan

systems/coppelius/src/Coppelius/ArenaPlan.alpha

157 lines43 declarations5.9 KiBSHA-256 f95da0a5524e

Complete file · line 147

ArenaPlan.alpha

Definition view
1module Coppelius.ArenaPlan
2
3import Compiler.Planning.VA
4import Platform.Linux.Nvidia.PlanHost
5import Coppelius.SM86Capability
6import Model.Config
7import Model.Parameter
8import Model.Word64
9import Std.Natural
10import Std.Physical
11
12-- Fixed addresses are part of this artifact ABI.  The generic address-plan
13-- and UVM/RM owners remain shared; this value records only Coppelius placement.
14family CoppeliusArenaPlan : Type 0
15constructor CoppeliusArenaPlanValue
16field unrestricted coppeliusArenaProfileIdentity : Bytes
17field unrestricted coppeliusArenaVideoBase : DeviceAddress
18field unrestricted coppeliusArenaVideoBytes : ByteCount
19field unrestricted coppeliusArenaVideoEnd : DeviceAddress
20field unrestricted coppeliusArenaAlignmentBytes : ByteAlignment
21field unrestricted coppeliusArenaPersistentEndOffset : ByteCount
22field unrestricted coppeliusArenaWorkspaceEndOffset : ByteCount
23field unrestricted coppeliusArenaProgramBytes : ByteCount
24field unrestricted coppeliusArenaQMDBytes : ByteCount
25field unrestricted coppeliusArenaOutputStagingBytes : ByteCount
26field unrestricted coppeliusArenaGPFIFOAndUSERDBytes : ByteCount
27field unrestricted coppeliusArenaCheckpointStagingBytes : ByteCount
28field unrestricted coppeliusArenaAllowedHostFallbacks : Nat
29
30end-family
31
32-- The naturals are the values the host derivation (Coppelius.Build.NativeHost)
33-- places by; the typed values are the same numbers for the plan.
34def coppeliusSM86CompatVideoBaseNatural : Nat =
35  0x0000_0009_0000_0000
36
37def coppeliusSM86CompatVideoBase : DeviceAddress =
38  (stdDeviceAddress (modelWord64FromNaturalTruncated coppeliusSM86CompatVideoBaseNatural))
39
40def coppeliusSM86CompatVideoBytesNatural : Nat =
41  2_147_483_648
42
43def coppeliusSM86CompatVideoBytes : ByteCount =
44  (stdByteCount (modelWord64FromNaturalTruncated coppeliusSM86CompatVideoBytesNatural))
45
46def coppeliusSM86CompatVideoEnd : DeviceAddress =
47  (stdDeviceAddress 0x0000_0009_8000_0000)
48
49def coppeliusSM86CompatArenaAlignment : ByteAlignment =
50  (stdByteAlignment 2_097_152)
51
52def coppeliusSM86CompatPersistentEndOffset : ByteCount =
53  (stdByteCount 1_038_630_912)
54
55def coppeliusSM86CompatWorkspaceEndOffset : ByteCount =
56  (stdByteCount 1_207_205_888)
57
58def coppeliusSM86CompatProgramBytesNatural : Nat =
59  4_194_304
60
61def coppeliusSM86CompatProgramBytes : ByteCount =
62  (stdByteCount (modelWord64FromNaturalTruncated coppeliusSM86CompatProgramBytesNatural))
63
64def coppeliusSM86CompatQMDBytesNatural : Nat =
65  8_388_608
66
67def coppeliusSM86CompatQMDBytes : ByteCount =
68  (stdByteCount (modelWord64FromNaturalTruncated coppeliusSM86CompatQMDBytesNatural))
69
70-- The host maps the first half of the QMD arena directly; any compiler-owned
71-- overflow is mapped as the adjacent typed region.
72def coppeliusSM86CompatQMDPrimaryBytesNatural : Nat =
73  4_194_304
74
75def coppeliusSM86CompatOutputStagingBytes : ByteCount =
76  (stdByteCount 4_194_304)
77
78def coppeliusSM86CompatGPFIFOAndUSERDBytesNatural : Nat =
79  266_240
80
81def coppeliusSM86CompatGPFIFOAndUSERDBytes : ByteCount =
82  (stdByteCount (modelWord64FromNaturalTruncated coppeliusSM86CompatGPFIFOAndUSERDBytesNatural))
83
84def coppeliusSM86CompatCheckpointStagingBytesNatural : Nat =
85  4_194_304
86
87def coppeliusSM86CompatCheckpointStagingBytes : ByteCount =
88  (stdByteCount (modelWord64FromNaturalTruncated coppeliusSM86CompatCheckpointStagingBytesNatural))
89
90def coppeliusSM86CompatArenaPlan : (family CoppeliusArenaPlan) =
91  (record
92    CoppeliusArenaPlan
93    (coppeliusArenaProfileIdentity = coppeliusSM86CompatProfileIdentity)
94    (coppeliusArenaVideoBase = coppeliusSM86CompatVideoBase)
95    (coppeliusArenaVideoBytes = coppeliusSM86CompatVideoBytes)
96    (coppeliusArenaVideoEnd = coppeliusSM86CompatVideoEnd)
97    (coppeliusArenaAlignmentBytes = coppeliusSM86CompatArenaAlignment)
98    (coppeliusArenaPersistentEndOffset = coppeliusSM86CompatPersistentEndOffset)
99    (coppeliusArenaWorkspaceEndOffset = coppeliusSM86CompatWorkspaceEndOffset)
100    (coppeliusArenaProgramBytes = coppeliusSM86CompatProgramBytes)
101    (coppeliusArenaQMDBytes = coppeliusSM86CompatQMDBytes)
102    (coppeliusArenaOutputStagingBytes = coppeliusSM86CompatOutputStagingBytes)
103    (coppeliusArenaGPFIFOAndUSERDBytes = coppeliusSM86CompatGPFIFOAndUSERDBytes)
104    (coppeliusArenaCheckpointStagingBytes = coppeliusSM86CompatCheckpointStagingBytes)
105    (coppeliusArenaAllowedHostFallbacks = 0))
106
107-- ---- placement ----
108-- The buffers whose place the plan itself depends on, in the card's address
109-- space from the device origin (Compiler.Planning.VA) and in the process from
110-- the plan host's mapping origin (the arena itself is the UVM external range
111-- above): the channel's GPFIFO; the staging window the kernels read their
112-- input from and write their results to (Coppelius.TrainingRun lays it
113-- out); the program region the device images are placed in
114-- (Coppelius.Build.DeviceImages).  The buffers the plan sizes follow them
115-- (Coppelius.Build.Placement).  The host side of the arena certificate
116-- decides that all of them are disjoint and clear of the host's own
117-- mappings.
118def coppeliusDeviceOrigin : Nat = vaBaseNatural
119
120def coppeliusDeviceSpaceAlignment : Nat =
121  0x0100_0000
122
123def coppeliusGPFIFOBase : Nat =
124  coppeliusDeviceOrigin
125
126def coppeliusStagingBase : Nat =
127  (vaPlaceAfter
128    coppeliusGPFIFOBase
129    coppeliusSM86CompatGPFIFOAndUSERDBytesNatural
130    coppeliusDeviceSpaceAlignment)
131
132def coppeliusProgramBase : Nat =
133  (vaPlaceAfter
134    coppeliusStagingBase
135    coppeliusSM86CompatCheckpointStagingBytesNatural
136    coppeliusDeviceSpaceAlignment)
137
138def coppeliusHostGPFIFO : Nat =
139  nvidiaPlanHostMappingOrigin
140
141def coppeliusHostErrorNotifier : Nat =
142  (vaPlaceAfter
143    coppeliusHostGPFIFO
144    coppeliusSM86CompatGPFIFOAndUSERDBytesNatural
145    nvidiaPlanHostMappingAlignment)
146
147def coppeliusHostStaging : Nat =
148  (vaPlaceAfter
149    coppeliusHostErrorNotifier
150    nvidiaPlanHostErrorPageBytes
151    nvidiaPlanHostMappingAlignment)
152
153def coppeliusHostProgram : Nat =
154  (vaPlaceAfter
155    coppeliusHostStaging
156    coppeliusSM86CompatCheckpointStagingBytesNatural
157    nvidiaPlanHostMappingAlignment)

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.