From 3237f639e50a9e08f8d8151bce65c040c255504d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 26 Feb 2025 20:24:47 +0100 Subject: [PATCH 1/3] fix: supra: Correctly propagate hashers per thread config --- tasks/sealsupra/supra_config.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tasks/sealsupra/supra_config.go b/tasks/sealsupra/supra_config.go index 39105b9d6..71df8ecaa 100644 --- a/tasks/sealsupra/supra_config.go +++ b/tasks/sealsupra/supra_config.go @@ -54,6 +54,8 @@ type SupraSealConfig struct { P2WrRdOverlap bool P2HsP1WrOverlap bool P2HcP2RdOverlap bool + + HashersPerThread int } type AdditionalSystemInfo struct { @@ -151,18 +153,19 @@ func GenerateSupraSealConfig(info SystemInfo, dualHashers bool, batchSize int, n P2WrRdOverlap: true, P2HsP1WrOverlap: true, P2HcP2RdOverlap: true, + + HashersPerThread: 1, } - sectorsPerThread := 1 if dualHashers { - sectorsPerThread = 2 + config.HashersPerThread = 2 } ccxFreeCores := info.CoresPerL3 - 1 // one core per ccx goes to the coordinator ccxFreeThreads := ccxFreeCores * info.ThreadsPerCore - sectorsPerCCX := ccxFreeThreads * sectorsPerThread + sectorsPerCCX := ccxFreeThreads * config.HashersPerThread - config.RequiredThreads = batchSize / sectorsPerThread + config.RequiredThreads = batchSize / config.HashersPerThread config.RequiredCCX = (batchSize + sectorsPerCCX - 1) / sectorsPerCCX config.RequiredCores = config.RequiredCCX + config.RequiredThreads/info.ThreadsPerCore @@ -306,7 +309,12 @@ func FormatSupraSealConfig(config SupraSealConfig, system SystemInfo, additional w(" qpair_writer = 1;") w(" reader_sleep_time = 250;") w(" writer_sleep_time = 500;") - w(" hashers_per_core = 2;") + + if config.HashersPerThread == 2 { + w(" hashers_per_core = 2;") + } else { + w(" hashers_per_core = 1;") + } w("") w(" sector_configs: (") From aed9007c43329a03e998cf134e9382531c601e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 27 Feb 2025 14:29:37 +0100 Subject: [PATCH 2/3] fix hasher math --- tasks/sealsupra/supra_config.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tasks/sealsupra/supra_config.go b/tasks/sealsupra/supra_config.go index 71df8ecaa..254e1cab1 100644 --- a/tasks/sealsupra/supra_config.go +++ b/tasks/sealsupra/supra_config.go @@ -11,6 +11,8 @@ import ( "github.com/samber/lo" ) +const SectorsPerHasher = 2 + type SystemInfo struct { ProcessorCount int CoreCount int @@ -55,7 +57,7 @@ type SupraSealConfig struct { P2HsP1WrOverlap bool P2HcP2RdOverlap bool - HashersPerThread int + HashersPerCore int } type AdditionalSystemInfo struct { @@ -154,20 +156,20 @@ func GenerateSupraSealConfig(info SystemInfo, dualHashers bool, batchSize int, n P2HsP1WrOverlap: true, P2HcP2RdOverlap: true, - HashersPerThread: 1, + HashersPerCore: 1, } if dualHashers { - config.HashersPerThread = 2 + config.HashersPerCore = 2 } ccxFreeCores := info.CoresPerL3 - 1 // one core per ccx goes to the coordinator - ccxFreeThreads := ccxFreeCores * info.ThreadsPerCore - sectorsPerCCX := ccxFreeThreads * config.HashersPerThread + ccxFreeThreads := ccxFreeCores * config.HashersPerCore + sectorsPerCCX := ccxFreeThreads * SectorsPerHasher - config.RequiredThreads = batchSize / config.HashersPerThread + config.RequiredThreads = batchSize / SectorsPerHasher config.RequiredCCX = (batchSize + sectorsPerCCX - 1) / sectorsPerCCX - config.RequiredCores = config.RequiredCCX + config.RequiredThreads/info.ThreadsPerCore + config.RequiredCores = config.RequiredCCX + config.RequiredThreads/config.HashersPerCore if config.RequiredCores > info.CoreCount { return config, fmt.Errorf("not enough cores available for hashers") @@ -310,7 +312,7 @@ func FormatSupraSealConfig(config SupraSealConfig, system SystemInfo, additional w(" reader_sleep_time = 250;") w(" writer_sleep_time = 500;") - if config.HashersPerThread == 2 { + if config.HashersPerCore == 2 { w(" hashers_per_core = 2;") } else { w(" hashers_per_core = 1;") From 33307354f81ce539e15abc2246734c496fdc0bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 27 Feb 2025 14:32:35 +0100 Subject: [PATCH 3/3] correct number in assign --- tasks/sealsupra/supra_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sealsupra/supra_config.go b/tasks/sealsupra/supra_config.go index 254e1cab1..5f88d46ea 100644 --- a/tasks/sealsupra/supra_config.go +++ b/tasks/sealsupra/supra_config.go @@ -239,7 +239,7 @@ func GenerateSupraSealConfig(info SystemInfo, dualHashers bool, batchSize int, n sectorConfig.Coordinators = append(sectorConfig.Coordinators, CoordinatorConfig{ Core: coreNum, - Hashers: (toAssign - 1) * info.ThreadsPerCore, + Hashers: (toAssign - 1) * config.HashersPerCore, }) i -= toAssign