forked from lightvector/KataGo
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit refactors the `SWPolicyHeadDesc` struct and related calculation code in `metalbackend.swift` to accommodate model versions 15 and higher. Specifically, it adds new fields to `SWPolicyHeadDesc` for the bias layer description, pass activation function, and an additional fully connected linear layer. The changes ensure appropriate handling of these components in the calculation of the policy head. The modifications address the need to incorporate these additional layers in the neural network's policy head for incremented model versions. By properly configuring the policy head description and adjusting the corresponding calculation code, the Metal backend can now handle model version 15 accurately. The GPU error of Metal backend is shown as follows: ``` : Loaded 2247 positions from: base-s1436726784.bin : Running batched evaluations in fp32 : Running evaluations using current config : Running batched evaluations using current config : Computed stats on 2247 positions : Reporting the average, 90%, 99%, and max abs error between the following configurations: : batched fp32 - fp32 winrateError: 0.00003% 0.00008% 0.00016% 0.00032% : batched fp32 - fp32 scoreError: 0.00001 0.00002 0.00004 0.00009 : batched fp32 - fp32 topPolicyDelta: 0.00006% 0.00013% 0.00023% 0.00038% : batched fp32 - fp32 policyKLDiv: -0.000000 0.000000 0.000000 0.000000 : current - fp32 winrateError: 0.00003% 0.00008% 0.00016% 0.00027% : current - fp32 scoreError: 0.00001 0.00002 0.00004 0.00010 : current - fp32 topPolicyDelta: 0.00006% 0.00013% 0.00021% 0.00040% : current - fp32 policyKLDiv: -0.000000 0.000000 0.000000 0.000000 : batched current - fp32 winrateError: 0.00003% 0.00008% 0.00015% 0.00032% : batched current - fp32 scoreError: 0.00001 0.00002 0.00004 0.00010 : batched current - fp32 topPolicyDelta: 0.00006% 0.00013% 0.00023% 0.00040% : batched current - fp32 policyKLDiv: -0.000000 0.000000 0.000000 0.000000 : GPU -1 finishing, processed 2247 rows 282 batches : GPU -1 finishing, processed 4494 rows 2529 batches ```
- Loading branch information
1 parent
ff76c07
commit 8380a78
Showing
3 changed files
with
275 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.