From 5ee2b8192feeaa739fed39b3a3a093ffc544fbfa Mon Sep 17 00:00:00 2001 From: Harold B Date: Fri, 4 Nov 2022 23:06:37 -0500 Subject: [PATCH 1/4] Backport fix for wrong struct selection for C table parks. An error where the wrong struct with the same name would be selected for C table writing in diskplot and ramplot would cause corruption of data. --- src/plotting/TableWriter.h | 79 +++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/src/plotting/TableWriter.h b/src/plotting/TableWriter.h index 2ecf75e3..25c78306 100644 --- a/src/plotting/TableWriter.h +++ b/src/plotting/TableWriter.h @@ -4,7 +4,7 @@ #include "threading/MTJob.h" #include "plotting/CTables.h" -struct TableWriter +namespace TableWriter { /// P7 // Table 7's indices into the Table 6's entries. @@ -37,43 +37,51 @@ struct TableWriter static void WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId = 0 ); static void WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId = 0 ); -}; -struct P7Job : MTJob -{ - uint64 parkCount; - const uint32* indices; - byte* parkBuffer; + /// Jobs + struct P7Job : MTJob + { + uint64 parkCount; + const uint32* indices; + byte* parkBuffer; - void Run() override; -}; + void Run() override; + }; -template -struct C12Job : MTJob> -{ - uint64 length; - const uint32* f7Entries; - uint32* writeBuffer; + template + struct C12Job : MTJob> + { + uint64 length; + const uint32* f7Entries; + uint32* writeBuffer; - void Run() override; -}; + void Run() override; + }; -struct C3Job : MTJob -{ - uint64 parkCount; - uint32* f7Entries; - byte* writeBuffer; - - void Run() override; -}; + struct C3Job : MTJob + { + uint64 parkCount; + uint32* f7Entries; + byte* writeBuffer; + + void Run() override; + }; +} // End NS +/// +/// Implementation +/// + +namespace TableWriter +{ + /// /// P7 /// //----------------------------------------------------------- template -inline size_t TableWriter::WriteP7( ThreadPool& threadPool, uint32 threadCount, const uint64 length, +inline size_t WriteP7( ThreadPool& threadPool, uint32 threadCount, const uint64 length, const uint32* indices, byte* parkBuffer ) { threadCount = std::min( threadCount, MAX_JOBS ); @@ -137,7 +145,7 @@ inline size_t TableWriter::WriteP7( ThreadPool& threadPool, uint32 threadCount, } //----------------------------------------------------------- -inline void TableWriter::WriteP7Parks( const uint64 parkCount, const uint32* indices, byte* parkBuffer, uint32 jobId ) +inline void WriteP7Parks( const uint64 parkCount, const uint32* indices, byte* parkBuffer, uint32 jobId ) { const size_t parkSize = CDiv( (_K + 1) * kEntriesPerPark, 8 ); @@ -151,7 +159,7 @@ inline void TableWriter::WriteP7Parks( const uint64 parkCount, const uint32* ind //----------------------------------------------------------- template -inline void TableWriter::WriteP7Entries( const uint64 length, const TIdx* indices, byte* parkBuffer, uint32 jobId ) +inline void WriteP7Entries( const uint64 length, const TIdx* indices, byte* parkBuffer, uint32 jobId ) { ASSERT( length <= kEntriesPerPark ); ASSERT( ((uintptr_t)parkBuffer & 7 ) == 0 ); @@ -219,7 +227,7 @@ inline void P7Job::Run() /// //----------------------------------------------------------- template -inline size_t TableWriter::WriteC12Parallel( +inline size_t WriteC12Parallel( ThreadPool& pool, uint32 threadCount, const uint64 length, const uint32* f7Entries, uint32* parkBuffer ) { @@ -280,7 +288,7 @@ inline size_t TableWriter::WriteC12Parallel( //----------------------------------------------------------- template -inline void TableWriter::WriteC12Entries( const uint64 length, const uint32* f7Entries, uint32* c1Buffer ) +inline void WriteC12Entries( const uint64 length, const uint32* f7Entries, uint32* c1Buffer ) { uint64 f7Src = 0; for( uint64 i = 0; i < length; i++, f7Src += CInterval ) @@ -298,7 +306,7 @@ inline void C12Job::Run() /// C3 /// //----------------------------------------------------------- -inline uint64 TableWriter::GetC3ParkCount( const uint64 length, uint64& outLastParkRemainder ) +inline uint64 GetC3ParkCount( const uint64 length, uint64& outLastParkRemainder ) { const uint64 c3ParkCount = length / kCheckpoint1Interval; const uint64 lastParkRemainder = length - ( c3ParkCount * kCheckpoint1Interval ); @@ -316,7 +324,7 @@ inline uint64 TableWriter::GetC3ParkCount( const uint64 length, uint64& outLastP } //----------------------------------------------------------- -inline uint64 TableWriter::GetC3ParkCount( const uint64 length ) +inline uint64 GetC3ParkCount( const uint64 length ) { uint64 remainder; return GetC3ParkCount( length, remainder ); @@ -324,7 +332,7 @@ inline uint64 TableWriter::GetC3ParkCount( const uint64 length ) //----------------------------------------------------------- template -inline size_t TableWriter::WriteC3Parallel( ThreadPool& pool, uint32 threadCount, const uint64 length, uint32* f7Entries, byte* c3Buffer ) +inline size_t WriteC3Parallel( ThreadPool& pool, uint32 threadCount, const uint64 length, uint32* f7Entries, byte* c3Buffer ) { threadCount = std::min( threadCount, MAX_JOBS ); @@ -377,7 +385,7 @@ inline size_t TableWriter::WriteC3Parallel( ThreadPool& pool, uint32 threadCount } //----------------------------------------------------------- -inline void TableWriter::WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId ) +inline void WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId ) { const size_t c3Size = CalculateC3Size(); @@ -391,7 +399,7 @@ inline void TableWriter::WriteC3Parks( const uint64 parkCount, uint32* f7Entries } //----------------------------------------------------------- -inline void TableWriter::WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId ) +inline void WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId ) { ASSERT( length <= kCheckpoint1Interval-1 ); @@ -441,3 +449,4 @@ inline void C3Job::Run() } +} // End nS From 7b5cb4ac5d73526996595120cd9a25e17a03bed9 Mon Sep 17 00:00:00 2001 From: Harold B Date: Fri, 4 Nov 2022 23:39:15 -0500 Subject: [PATCH 2/4] Remove testing time forced warm start --- src/plotdisk/DiskPlotter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plotdisk/DiskPlotter.cpp b/src/plotdisk/DiskPlotter.cpp index 93b2db79..d355232f 100644 --- a/src/plotdisk/DiskPlotter.cpp +++ b/src/plotdisk/DiskPlotter.cpp @@ -117,9 +117,7 @@ DiskPlotter::DiskPlotter( const Config& cfg ) _cx.ioQueue = new DiskBufferQueue( _cx.tmpPath, _cx.tmpPath2, gCfg.outputFolder, _cx.heapBuffer, _cx.heapSize, _cx.ioThreadCount, ioThreadId ); _cx.fencePool = new FencePool( 8 ); - // if( cfg.globalCfg->warmStart ) - // #TODO: IMPORTANT: Remove this after testing - Log::Line( "WARNING: Forcing warm start for testing." ); + if( cfg.globalCfg->warmStart ) { Log::Line( "Warm start: Pre-faulting memory pages..." ); From e93d2d9801210e22781e9f7c9f147daff762e002 Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Mon, 7 Nov 2022 15:38:07 -0500 Subject: [PATCH 3/4] RC1 - fix C memory corruption when writing C tables Fix version extraction suffix issue --- VERSION | 3 ++- extract-version.sh | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 227cea21..dbcb7da6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1,2 @@ -2.0.0 +2.0.1 +rc1 \ No newline at end of file diff --git a/extract-version.sh b/extract-version.sh index 5797c556..0f50751f 100755 --- a/extract-version.sh +++ b/extract-version.sh @@ -19,6 +19,11 @@ if [[ "$version_str" == "$bb_version_suffix" ]]; then bb_version_suffix= fi +# prepend a '-' to the suffix, if necessarry +if [[ -n "$bb_version_suffix" ]] && [[ "${bb_version_suffix:0:1}" != "-" ]]; then + bb_version_suffix="-${bb_version_suffix}" +fi + bb_ver_maj=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/' | xargs) bb_ver_min=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/' | xargs) bb_ver_rev=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/' | xargs) From c02df73217861d4cf24ade625fa49d6a695e10d0 Mon Sep 17 00:00:00 2001 From: Harold Brenes Date: Mon, 7 Nov 2022 16:11:05 -0500 Subject: [PATCH 4/4] Version bump to 2.0.1 --- VERSION | 1 - 1 file changed, 1 deletion(-) diff --git a/VERSION b/VERSION index dbcb7da6..38f77a65 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1 @@ 2.0.1 -rc1 \ No newline at end of file