Skip to content

Commit 4fa3e6c

Browse files
authored
Merge pull request #6544 from IntersectMBO/bench/genesis
wb | genesis: leaner cache and Plutus cost models
2 parents 3c4551e + eb0989b commit 4fa3e6c

93 files changed

Lines changed: 87443 additions & 38066 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ include nix.mk
77
PROJECT_NAME = cardano-node
88
NUM_PROC = $(nproc --all)
99

10-
## One of: shey alra mary alzo bage coay
11-
ERA ?= coay
12-
13-
PROFILE ?= default-${ERA}
10+
PROFILE ?= default
11+
## One of: shelley allegra mary alonzo babbage conway dijkstra
12+
ERA ?= conway
1413
BACKEND ?= supervisor
1514
REV ?= master
1615
ITER ?=
@@ -66,8 +65,8 @@ workbench-internals-walkthrough:
6665
##
6766
## Base targets:
6867
##
69-
shell: ## Nix shell, (workbench from /nix/store), vars: PROFILE, CMD, RUN
70-
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName ${PROFILE} --argstr backendName ${BACKEND} ${ARGS} ${if ${CMD},--command "${CMD}"} ${if ${RUN},--run "${RUN}"}
68+
shell: ## Nix shell, (workbench from /nix/store), vars: PROFILE, ERA, CMD, RUN
69+
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName ${PROFILE} --argstr eraName ${ERA} --argstr backendName ${BACKEND} ${ARGS} ${if ${CMD},--command "${CMD}"} ${if ${RUN},--run "${RUN}"}
7170
shell-dev shell-prof shell-nix: shell
7271
shell-nix: ARGS += --arg 'useCabalRun' false ## Nix shell, (workbench from Nix store), vars: PROFILE, CMD, RUN
7372
shell-prof: ARGS += --arg 'profiledBuild' true --arg 'profilingType' '"space-heap"' ## Nix shell, everything Haskell built profiled and run with `-hT`.
@@ -96,7 +95,7 @@ $(eval $(call define_profile_targets_nomadcloud,$(CLOUD_PROFILES)))
9695

9796
# Dynamic local/supervisor profile targets.
9897
playground-%:
99-
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName $*-${ERA} --argstr backendName supervisor
98+
nix-shell -A 'workbench-shell' --max-jobs 8 --cores 0 --show-trace --argstr profileName $* --argstr eraName ${ERA} --argstr backendName supervisor
10099

101100
###
102101
### Misc

bench/cardano-profile/app/cardano-profile.hs

Lines changed: 72 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
--------------------------------------------------------------------------------
44

5+
-- base.
56
import Prelude
6-
7-
import Data.Bool (bool)
87
import System.Environment (lookupEnv)
98
import GHC.Stack (HasCallStack)
109
-- Package: aeson.
@@ -24,61 +23,64 @@ import qualified Cardano.Benchmarking.Profile.NodeSpecs as NodeSpecs
2423
import qualified Cardano.Benchmarking.Profile.Types as Types
2524
-- Profiles to export!
2625
-- Static / built-in / profiles part of the test-suite.
27-
import Cardano.Benchmarking.Profile.Builtin.Cloud (profilesNoEraCloud)
28-
import Cardano.Benchmarking.Profile.Builtin.Empty (profilesNoEraEmpty)
29-
import Cardano.Benchmarking.Profile.Builtin.ForgeStress (profilesNoEraForgeStress)
30-
import Cardano.Benchmarking.Profile.Builtin.K3 (profilesNoEraK3)
31-
import Cardano.Benchmarking.Profile.Builtin.Legacy.Dense (profilesNoEraDense)
32-
import Cardano.Benchmarking.Profile.Builtin.Legacy.Dish (profilesNoEraDish)
33-
import Cardano.Benchmarking.Profile.Builtin.Miniature (profilesNoEraMiniature)
34-
import Cardano.Benchmarking.Profile.Builtin.Model (profilesNoEraModel)
35-
import Cardano.Benchmarking.Profile.Builtin.Plutuscall (profilesNoEraPlutuscall)
36-
import Cardano.Benchmarking.Profile.Builtin.Scenario.Chainsync (profilesNoEraChainsync)
37-
import Cardano.Benchmarking.Profile.Builtin.Scenario.Idle (profilesNoEraIdle)
38-
import Cardano.Benchmarking.Profile.Builtin.Scenario.TracerOnly (profilesNoEraTracerOnly)
39-
import Cardano.Benchmarking.Profile.Extra.Scaling (profilesNoEraScalingLocal, profilesNoEraScalingCloud)
26+
import Cardano.Benchmarking.Profile.Builtin.Cloud (profilesCloud)
27+
import Cardano.Benchmarking.Profile.Builtin.Empty (profilesEmpty)
28+
import Cardano.Benchmarking.Profile.Builtin.ForgeStress (profilesForgeStress)
29+
import Cardano.Benchmarking.Profile.Builtin.K3 (profilesK3)
30+
import Cardano.Benchmarking.Profile.Builtin.Legacy.Dense (profilesDense)
31+
import Cardano.Benchmarking.Profile.Builtin.Legacy.Dish (profilesDish)
32+
import Cardano.Benchmarking.Profile.Builtin.Miniature (profilesMiniature)
33+
import Cardano.Benchmarking.Profile.Builtin.Model (profilesModel)
34+
import Cardano.Benchmarking.Profile.Builtin.Plutuscall (profilesPlutuscall)
35+
import Cardano.Benchmarking.Profile.Builtin.Scenario.Chainsync (profilesChainsync)
36+
import Cardano.Benchmarking.Profile.Builtin.Scenario.Idle (profilesIdle)
37+
import Cardano.Benchmarking.Profile.Builtin.Scenario.TracerOnly (profilesTracerOnly)
38+
import Cardano.Benchmarking.Profile.Extra.Scaling (profilesScalingLocal, profilesScalingCloud)
4039
-- Dynamic profiles.
41-
import Cardano.Benchmarking.Profile.Playground (profilesNoEraPlayground)
40+
import Cardano.Benchmarking.Profile.Playground (profilesPlayground)
4241

4342
--------------------------------------------------------------------------------
4443

4544
allProfiles :: [Types.Profile]
4645
allProfiles = performanceAndTracingProfiles ++ playgroundProfiles
4746

4847
cloudProfiles :: [Types.Profile]
49-
cloudProfiles = profilesNoEraCloud
48+
cloudProfiles = profilesCloud
5049

5150
-- "families" of profiles. Grouped by common properties or intentions.
5251
performanceAndTracingProfiles :: [Types.Profile]
5352
performanceAndTracingProfiles =
5453
cloudProfiles
55-
++ profilesNoEraEmpty -- Empty datasets running `FixedLoaded`.
56-
++ profilesNoEraForgeStress -- All the "forge-stress*" profiles.
57-
++ profilesNoEraK3 -- K3
54+
-- Empty datasets running `FixedLoaded`.
55+
++ profilesEmpty
56+
-- All the "forge-stress*" profiles.
57+
++ profilesForgeStress
58+
-- K3.
59+
++ profilesK3
5860
-- Legacy.
59-
++ profilesNoEraDense
60-
++ profilesNoEraDish
61-
++ profilesNoEraMiniature
62-
++ profilesNoEraModel --
63-
++ profilesNoEraPlutuscall --
61+
++ profilesDense
62+
++ profilesDish
63+
-- Light dataset.
64+
++ profilesMiniature
65+
++ profilesModel
66+
++ profilesPlutuscall
6467
-- Empty datasets not running `FixedLoaded`.
65-
++ profilesNoEraChainsync -- Scenario `Chainsync`
66-
++ profilesNoEraIdle -- Scenario `Idle`
67-
++ profilesNoEraTracerOnly -- Scenario `TracerOnly`
68-
-- Extra modules
69-
++ profilesNoEraScalingLocal
70-
++ profilesNoEraScalingCloud
68+
++ profilesChainsync -- Scenario `Chainsync`
69+
++ profilesIdle -- Scenario `Idle`
70+
++ profilesTracerOnly -- Scenario `TracerOnly`
71+
-- Extra profiles.
72+
++ profilesScalingLocal
73+
++ profilesScalingCloud
7174

7275
-- Have fun!
7376
playgroundProfiles :: [Types.Profile]
74-
playgroundProfiles = profilesNoEraPlayground
77+
playgroundProfiles = profilesPlayground
7578

7679
--------------------------------------------------------------------------------
7780

7881
data Cli =
79-
NamesNoEra
80-
| NamesCloudNoEra
81-
| Names
82+
Names
83+
| NamesCloud
8284
| All [CliOptions]
8385
| ByName [CliOptions] String
8486
| LibMK
@@ -89,13 +91,13 @@ data Cli =
8991

9092
data CliOptions =
9193
OptPrettyPrint
92-
| OptWithEra
9394
| OptWithPlayground
9495
deriving Eq
9596

9697
--------------------------------------------------------------------------------
9798

98-
-- | Construct Map with profile name as key, without eras (in name and object).
99+
-- | Construct Map of `Profile` with the key being the profile name after
100+
-- applying an optional overlay.
99101
toMap :: HasCallStack => Maybe Aeson.Object -> [Types.Profile] -> Map.Map String Types.Profile
100102
toMap maybeObj ps = Map.fromList $ map
101103
(\p ->
@@ -125,28 +127,27 @@ main :: IO ()
125127
main = do
126128
cli <- getOpts
127129
case cli of
128-
-- Print all profile names without the era suffix (does not apply overlays).
129-
NamesNoEra -> BSL8.putStrLn $ Aeson.encode $ map Types.name allProfiles
130-
-- Print all cloud profile (-nomadperf) names (does not apply overlays).
131-
NamesCloudNoEra -> BSL8.putStrLn $ Aeson.encode $ map Types.name cloudProfiles
132-
-- Print all profile names (applies overlays!!!!!).
130+
-- Print all profile names, with an optional overlay.
133131
Names -> do
134-
maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra`.
135-
BSL8.putStrLn $ Aeson.encode $ Map.keys $ Profile.addEras $ toMap maybeObj allProfiles
132+
maybeObj <- lookupOverlay -- Ignored by `NamesCloud`.
133+
BSL8.putStrLn $ Aeson.encode $ Map.keys $ toMap maybeObj allProfiles
134+
-- Print all cloud (-nomadperf) profile names, does not apply overlays.
135+
NamesCloud -> BSL8.putStrLn $ Aeson.encode $ map Types.name cloudProfiles
136136
-- Print a map with all profiles, with an optional overlay.
137137
All cliOptions -> do
138138
let
139-
targetProfiles = if OptWithPlayground `elem` cliOptions then allProfiles else performanceAndTracingProfiles
139+
targetProfiles = if OptWithPlayground `elem` cliOptions
140+
then allProfiles
141+
else performanceAndTracingProfiles
140142
enc = encoder cliOptions
141-
withEraSuffs = OptWithEra `elem` cliOptions
142-
maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra`.
143-
BSL8.putStrLn $ enc $ bool id Profile.addEras withEraSuffs $ toMap maybeObj targetProfiles
143+
maybeObj <- lookupOverlay -- Ignored by `NamesCloud`.
144+
BSL8.putStrLn $ enc $ toMap maybeObj targetProfiles
144145
-- Print a single profiles, with an optional overlay.
145146
ByName cliOptions profileName -> do
146-
maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra`.
147+
maybeObj <- lookupOverlay -- Ignored by `NamesCloud`.
147148
let
148149
enc = encoder cliOptions
149-
profiles = Profile.addEras $ toMap maybeObj allProfiles
150+
profiles = toMap maybeObj allProfiles
150151
case Map.lookup profileName profiles of
151152
Nothing -> error $ "No profile named \"" ++ profileName ++ "\""
152153
Just profile -> BSL8.putStrLn $ enc profile
@@ -199,40 +200,28 @@ getOpts = OA.execParser $
199200

200201
cliParser :: OA.Parser Cli
201202
cliParser = OA.hsubparser $
202-
OA.command "names-noera"
203-
(OA.info
204-
(pure NamesNoEra)
205-
(OA.fullDesc <> OA.header "names-noera" <> OA.progDesc "All profiles names (no era suffix)")
206-
)
207-
<>
208-
OA.command "names-cloud-noera"
209-
(OA.info
210-
(pure NamesCloudNoEra)
211-
(OA.fullDesc <> OA.header "names-cloud-noera" <> OA.progDesc "All cloud profiles names (no era suffix)")
212-
)
213-
<>
214203
OA.command "names"
215204
(OA.info
216205
(pure Names)
217206
(OA.fullDesc <> OA.header "names" <> OA.progDesc "All profiles names")
218207
)
219208
<>
220-
OA.command "all"
209+
OA.command "names-cloud"
221210
(OA.info
222-
(pure $ All [OptWithEra, OptWithPlayground])
223-
(OA.fullDesc <> OA.header "all" <> OA.progDesc "Create all profiles")
211+
(pure NamesCloud)
212+
(OA.fullDesc <> OA.header "names-cloud" <> OA.progDesc "All cloud profiles names")
224213
)
225214
<>
226-
OA.command "all-noera"
215+
OA.command "all"
227216
(OA.info
228217
(pure $ All [OptWithPlayground])
229-
(OA.fullDesc <> OA.header "all-noera" <> OA.progDesc "Create all profiles (no era suffix)")
218+
(OA.fullDesc <> OA.header "all" <> OA.progDesc "Create all profiles")
230219
)
231220
<>
232-
OA.command "allpt-noera"
221+
OA.command "allpt"
233222
(OA.info
234223
(pure $ All [OptPrettyPrint])
235-
(OA.fullDesc <> OA.header "allpt-noera" <> OA.progDesc "Create P&T profiles (no era suffix)")
224+
(OA.fullDesc <> OA.header "allpt" <> OA.progDesc "Create P&T profiles")
236225
)
237226
<>
238227
OA.command "by-name"
@@ -289,28 +278,28 @@ libMKLocations =
289278
-- Local profiles.
290279
("LOCAL_PROFILES", [
291280
-- Families of local profiles.
292-
("PROFILES_EMPTY" , profilesNoEraEmpty)
293-
, ("PROFILES_MINIATURE" , profilesNoEraMiniature)
294-
, ("PROFILES_FORGE_STRESS" , profilesNoEraForgeStress)
295-
, ("PROFILES_PLUTUSCALL" , profilesNoEraPlutuscall)
296-
, ("PROFILES_MODEL" , profilesNoEraModel)
297-
, ("PROFILES_K3" , profilesNoEraK3)
281+
("PROFILES_EMPTY" , profilesEmpty)
282+
, ("PROFILES_MINIATURE" , profilesMiniature)
283+
, ("PROFILES_FORGE_STRESS" , profilesForgeStress)
284+
, ("PROFILES_PLUTUSCALL" , profilesPlutuscall)
285+
, ("PROFILES_MODEL" , profilesModel)
286+
, ("PROFILES_K3" , profilesK3)
298287
, ("PROFILES_SCENARIOS" ,
299-
profilesNoEraChainsync
300-
++ profilesNoEraIdle
301-
++ profilesNoEraTracerOnly
288+
profilesChainsync
289+
++ profilesIdle
290+
++ profilesTracerOnly
302291
)
303292
, ("PROFILES_LEGACY" ,
304-
profilesNoEraDense
305-
++ profilesNoEraDish
293+
profilesDense
294+
++ profilesDish
306295
)
307-
, ("PROFILES_SCALING" , profilesNoEraScalingLocal)
296+
, ("PROFILES_SCALING" , profilesScalingLocal)
308297
])
309298
-- Cloud profiles.
310299
, ("CLOUD_PROFILES", [
311300
-- Families of cloud profiles.
312-
("PROFILES_NOMAD_PERF" , profilesNoEraCloud)
313-
, ("PROFILES_NOMAD_PERFSSD", profilesNoEraScalingCloud)
301+
("PROFILES_NOMAD_PERF" , profilesCloud)
302+
, ("PROFILES_NOMAD_PERFSSD", profilesScalingCloud)
314303
])
315304
]
316305

bench/cardano-profile/app/cardano-timeline.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{-# LANGUAGE OverloadedStrings #-}
22

3-
{-- Create a delta timeline with each parameters and cost changes that happened
4-
in an epoch using "epoch_param" and "cost_model" db-sync tables.
5-
--}
3+
{- Per-epoch delta of protocol parameters and cost models, built from the raw
4+
`epoch_param` and `cost_model` tables of a mainnet db-sync database.
5+
6+
Result is written to stdout. A snapshot of a previous run is kept at
7+
`data/db-sync/timeline-2025-03-01.json` (and similar dated files) for
8+
reference. The runtime timeline at `data/genesis/epoch-timeline.json` is
9+
hand-curated and is not touched by this tool.
10+
-}
611
--------------------------------------------------------------------------------
712

813
module Main where

bench/cardano-profile/cardano-profile.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ license: Apache-2.0
1313
license-files: LICENSE
1414
NOTICE
1515
build-type: Simple
16-
data-files: data/all-profiles-coay.json
16+
data-files: data/all-profiles.json
1717
data/db-sync/epoch_param.json
1818
data/db-sync/cost_model.json
1919
data/genesis/epoch-timeline.json

0 commit comments

Comments
 (0)