Bladeren bron

Call GetActiveProcessorGroupCount to set LZMA2's numThreadGroups, like 7-Zip itself does in System.cpp's CCpuGroups::Load. This makes allowing 256 max threads make sense again, without drawbacks.

Also see https://sourceforge.net/p/sevenzip/discussion/45797/thread/737d05d630
Martijn Laan 3 dagen geleden
bovenliggende
commit
72405d6196

BIN
Files/islzma.dll


+ 3 - 3
Files/islzma.dll.issig

@@ -1,8 +1,8 @@
 format issig-v2
 format issig-v2
 file-name "islzma.dll"
 file-name "islzma.dll"
 file-size 139408
 file-size 139408
-file-hash 6a7c37dfd77d54fc74ae619abb7eb3b15b29f5ae46610d44b5c3996b30f523e9
+file-hash 8af307ce3738ab1d37cc7e76b2f76615e2045597d4367c3e40d52b5f2fbd353d
 file-tag ""
 file-tag ""
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
-sig-r 1fa739588105d001abdc3a875d3d78c5f4b6285ac33c6eb4d8a5dcfe42b0a9fa
-sig-s bc73f03d2650aad22c0f0e9984116d6f3078b21cef3df23bea2016aaae757c67
+sig-r 311c6576030ffb0085a4105947d72bcd7d9027412d4678b116c7c74947dd66d2
+sig-s 6d006e7920bd150678a2b8a6d7bc9af5c3c8d2d968396f9486bb7f163a218e99

BIN
Files/islzma32.exe


+ 3 - 3
Files/islzma32.exe.issig

@@ -1,8 +1,8 @@
 format issig-v2
 format issig-v2
 file-name "islzma32.exe"
 file-name "islzma32.exe"
 file-size 203408
 file-size 203408
-file-hash 1609e93c89285c06d182c4368e66165fd49940727f3a71c503a9374975001c0e
+file-hash fd977c3ac44c56997d2b4fd6647e97e2457c43991a6ae26a4b2252c0eabdfebb
 file-tag ""
 file-tag ""
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
-sig-r 34193b3a6315f82a84efef57b90df582e29e4185a7d2f6fb798be1070e83b9dd
-sig-s a9c34814c9958fbcfe92ef4329c52b857d454397f3a803943f78a5d48fa0ab5e
+sig-r a39bf0505dea23a4ce95c7a4a608dda5fc70d084496b44a9362654a6ade1998f
+sig-s bb377316c2c7997127c461885a81779a152fe6ec8c3c1fe9faa9b4106a4d8892

BIN
Files/islzma64.exe


+ 3 - 3
Files/islzma64.exe.issig

@@ -1,8 +1,8 @@
 format issig-v2
 format issig-v2
 file-name "islzma64.exe"
 file-name "islzma64.exe"
 file-size 226448
 file-size 226448
-file-hash 1886dc7feb6c1ea500d1f01387f80b7164df171dbad0856f61eaf8bcc3e67fd1
+file-hash 87a50495aff580b78cad57906a765d3cf28ca508cfa95c24c1247c286ddf71b2
 file-tag ""
 file-tag ""
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
 key-id def0147c3bbc17ab99bf7b7a9c2de1390283f38972152418d7c2a4a7d7131a38
-sig-r fa2e0d3777a6b5ac72250f599d20c8ae0b9d41eb2a89651eaf59f72f48fec7db
-sig-s 46a110b603e586cb34bdeef97d7ec36d13a773e445be4fe9d2547197c7fb6488
+sig-r 49c7145a5605aa11584e72e48f1da20251ad1e642e5734ff825a4e31ddaf3746
+sig-s ebeeeb7fcd78065464bd500a65700eaa067beaf5629623a13fb0522deb8177fe

+ 2 - 2
ISHelp/isetup.xml

@@ -6240,10 +6240,10 @@ SignTool=byparam format c:
 </setuptopic>
 </setuptopic>
 
 
 <setuptopic directive="LZMANumBlockThreads">
 <setuptopic directive="LZMANumBlockThreads">
-<setupvalid><tt>1</tt> through <tt>64</tt></setupvalid>
+<setupvalid><tt>1</tt> through <tt>256</tt></setupvalid>
 <setupdefault><tt>1</tt></setupdefault>
 <setupdefault><tt>1</tt></setupdefault>
 <body>
 <body>
-<p>When compressing a large amount of data, the LZMA2 compressor has the ability to divide the data into "blocks" and compress two or more of these blocks in parallel through the use of additional threads (provided sufficient processor power is available). This directive specifies the number of threads to use -- that is, the maximum number of blocks that the LZMA2 compressor may compress in parallel.</p>
+<p>When compressing a large file, the LZMA2 compressor has the ability to divide its data into "blocks" and compress two or more of these blocks in parallel through the use of additional threads (provided sufficient processor power is available). This directive specifies the maximum number of threads to use -- that is, the maximum number of blocks that the LZMA2 compressor may compress in parallel. Using a high maximum requires a very large file before this maximum is fully utilized.</p>
 <p>The memory required during compression when multiple block threads are used is roughly:</p>
 <p>The memory required during compression when multiple block threads are used is roughly:</p>
 <indent><p>LZMANumBlockThreads * (<link topic="setup_compression">Normal memory usage</link> + (<link topic="setup_lzmablocksize">LZMABlockSize</link> * 2))</p></indent>
 <indent><p>LZMANumBlockThreads * (<link topic="setup_compression">Normal memory usage</link> + (<link topic="setup_lzmablocksize">LZMABlockSize</link> * 2))</p></indent>
 <p>Since LZMA2 (and LZMA) uses two threads for match-finding by default (see <link topic="setup_compressionthreads">CompressionThreads</link>), there ideally should be two processor cores available for each block thread. Thus, to see the maximum benefit from a value of <tt>2</tt>, four cores are needed.</p>
 <p>Since LZMA2 (and LZMA) uses two threads for match-finding by default (see <link topic="setup_compressionthreads">CompressionThreads</link>), there ideally should be two processor cores available for each block thread. Thus, to see the maximum benefit from a value of <tt>2</tt>, four cores are needed.</p>

+ 9 - 1
Projects/Src/Compiler.SetupCompiler.pas

@@ -2902,7 +2902,7 @@ begin
         CompressProps.BTMode := I;
         CompressProps.BTMode := I;
       end;
       end;
     ssLZMANumBlockThreads: begin
     ssLZMANumBlockThreads: begin
-        CompressProps.NumBlockThreads := StrToIntRange(Value, 1, 64);
+        CompressProps.NumBlockThreads := StrToIntRange(Value, 1, 256);
       end;
       end;
     ssLZMANumFastBytes: begin
     ssLZMANumFastBytes: begin
         CompressProps.NumFastBytes := StrToIntRange(Value, 5, 273);
         CompressProps.NumFastBytes := StrToIntRange(Value, 5, 273);
@@ -7673,6 +7673,7 @@ var
   AppNameHasConsts, AppVersionHasConsts, AppPublisherHasConsts,
   AppNameHasConsts, AppVersionHasConsts, AppPublisherHasConsts,
     AppCopyrightHasConsts, AppIdHasConsts, Uninstallable: Boolean;
     AppCopyrightHasConsts, AppIdHasConsts, Uninstallable: Boolean;
   PrivilegesRequiredValue: String;
   PrivilegesRequiredValue: String;
+  GetActiveProcessorGroupCountFunc: function: WORD; stdcall;
 begin
 begin
   { Sanity check: A single TSetupCompiler instance cannot be used to do
   { Sanity check: A single TSetupCompiler instance cannot be used to do
     multiple compiles. A separate instance must be used for each compile,
     multiple compiles. A separate instance must be used for each compile,
@@ -7711,6 +7712,13 @@ begin
     CompressMethod := cmLZMA2;
     CompressMethod := cmLZMA2;
     CompressLevel := clLZMAMax;
     CompressLevel := clLZMAMax;
     CompressProps := TLZMACompressorProps.Create;
     CompressProps := TLZMACompressorProps.Create;
+    GetActiveProcessorGroupCountFunc := GetProcAddress(GetModuleHandle(kernel32),
+      'GetActiveProcessorGroupCount');
+    if Assigned(GetActiveProcessorGroupCountFunc) then begin
+      const ActiveProcessorGroupCount = GetActiveProcessorGroupCountFunc;
+      if ActiveProcessorGroupCount > 1 then
+        CompressProps.NumThreadGroups := ActiveProcessorGroupCount;
+    end;
     CompressProps.WorkerProcessCheckTrust := True;
     CompressProps.WorkerProcessCheckTrust := True;
     CompressProps.WorkerProcessOnCheckedTrust := OnCheckedTrust;
     CompressProps.WorkerProcessOnCheckedTrust := OnCheckedTrust;
     UseSetupLdr := True;
     UseSetupLdr := True;

+ 3 - 0
Projects/Src/Compression.LZMACompressor.pas

@@ -40,6 +40,7 @@ type
     NumBlockThreads: Integer;
     NumBlockThreads: Integer;
     NumFastBytes: Integer;
     NumFastBytes: Integer;
     NumThreads: Integer;
     NumThreads: Integer;
+    NumThreadGroups: Integer;
     WorkerProcessCheckTrust: Boolean;
     WorkerProcessCheckTrust: Boolean;
     WorkerProcessOnCheckedTrust: TProc<Boolean>;
     WorkerProcessOnCheckedTrust: TProc<Boolean>;
     WorkerProcessFilename: String;
     WorkerProcessFilename: String;
@@ -56,6 +57,7 @@ type
     NumBlockThreads: Integer;
     NumBlockThreads: Integer;
     NumFastBytes: Integer;
     NumFastBytes: Integer;
     NumThreads: Integer;
     NumThreads: Integer;
+    NumThreadGroups: Integer;
   end;
   end;
   TLZMACompressorRingBuffer = record
   TLZMACompressorRingBuffer = record
     Count: Longint;         { updated by reader and writer using InterlockedExchangeAdd only }
     Count: Longint;         { updated by reader and writer using InterlockedExchangeAdd only }
@@ -919,6 +921,7 @@ begin
       EncProps.NumFastBytes := Props.NumFastBytes;
       EncProps.NumFastBytes := Props.NumFastBytes;
     if Props.NumThreads <> 0 then
     if Props.NumThreads <> 0 then
       EncProps.NumThreads := Props.NumThreads;
       EncProps.NumThreads := Props.NumThreads;
+    EncProps.NumThreadGroups := Props.NumThreadGroups;
     WorkerProcessCheckTrust := Props.WorkerProcessCheckTrust;
     WorkerProcessCheckTrust := Props.WorkerProcessCheckTrust;
     WorkerProcessOnCheckedTrust := Props.WorkerProcessOnCheckedTrust;
     WorkerProcessOnCheckedTrust := Props.WorkerProcessOnCheckedTrust;
     WorkerProcessFilename := Props.WorkerProcessFilename;
     WorkerProcessFilename := Props.WorkerProcessFilename;

+ 1 - 0
Projects/Src/Compression.LZMACompressor/islzma/islzma.c

@@ -73,6 +73,7 @@ SRes __stdcall LZMA_SetProps(struct LZMAHandle *handle,
 	if (handle->LZMA2) {
 	if (handle->LZMA2) {
 		props2.numBlockThreads_Max = encProps->NumBlockThreads;
 		props2.numBlockThreads_Max = encProps->NumBlockThreads;
 		props2.blockSize = encProps->BlockSize;
 		props2.blockSize = encProps->BlockSize;
+		props2.numThreadGroups = encProps->NumThreadGroups;
 		return Lzma2Enc_SetProps(handle->encoder2, &props2);
 		return Lzma2Enc_SetProps(handle->encoder2, &props2);
 	} else {
 	} else {
 		props1.writeEndMark = 1;
 		props1.writeEndMark = 1;

+ 1 - 0
Projects/Src/Compression.LZMACompressor/islzma/islzma.h

@@ -12,6 +12,7 @@ struct LZMAEncoderProps {
 	int NumBlockThreads;
 	int NumBlockThreads;
 	int NumFastBytes;
 	int NumFastBytes;
 	int NumThreads;
 	int NumThreads;
+	int NumThreadGroups;
 };
 };
 
 
 SRes __stdcall LZMA_Init(BOOL LZMA2, struct LZMAHandle **handle);
 SRes __stdcall LZMA_Init(BOOL LZMA2, struct LZMAHandle **handle);

+ 1 - 1
whatsnew.htm

@@ -204,7 +204,7 @@ Source: "https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1"; DestName:
     </ul>
     </ul>
   </li>
   </li>
   <li><tt>[Files]</tt> section parameter <tt>Excludes</tt> can now be combined with the <tt>external</tt> flag.</li>
   <li><tt>[Files]</tt> section parameter <tt>Excludes</tt> can now be combined with the <tt>external</tt> flag.</li>
-  <li>Increased the maximum value of <tt>[Setup]</tt> section directive <tt>LZMANumBlockThreads</tt> from 32 to 64.</li>
+  <li>Increased the maximum value of <tt>[Setup]</tt> section directive <tt>LZMANumBlockThreads</tt> from 32 to 256.</li>
   <li>Parameters <tt>ExternalSize</tt>, <tt>ExtraDiskSpaceRequired</tt>, and <tt>UninstallDisplaySize</tt> now support digit separators. Example: <tt>UninstallDisplaySize=1_073_741_824</tt>.<br/>
   <li>Parameters <tt>ExternalSize</tt>, <tt>ExtraDiskSpaceRequired</tt>, and <tt>UninstallDisplaySize</tt> now support digit separators. Example: <tt>UninstallDisplaySize=1_073_741_824</tt>.<br/>
       The same applies to <tt>[Registry]</tt> parameter <tt>ValueData</tt> if <tt>ValueType</tt> is set to <tt>qword</tt>.</li>
       The same applies to <tt>[Registry]</tt> parameter <tt>ValueData</tt> if <tt>ValueType</tt> is set to <tt>qword</tt>.</li>
   <li>ISPP changes:
   <li>ISPP changes: