Faster enumeration for helrm model - #3301
Open
copybara-service[bot] wants to merge 1 commit into
Open
Conversation
This came up while I was trying to compile the HELRM model. convert-to-ciphertext-semantics was taking 26 minutes to run. This change reduced that to about 2 minutes. The slow point was that the large layout was being explicitly folded in AUTO mode, and it was computing a bounding box of size 10^12 that was iterated over. ISL's native enumeration was much faster. Before this change: the assign_layout benchmark was ``` -------------------------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------------------------- BM_implementAssignLayout_Relation1/0 0.001 s 0.001 s 910 BM_implementAssignLayout_Relation1/1 0.001 s 0.001 s 956 BM_implementAssignLayout_Relation1/2 0.001 s 0.001 s 944 BM_implementAssignLayout_Relation2/0 0.063 s 0.063 s 12 BM_implementAssignLayout_Relation2/1 0.056 s 0.056 s 12 BM_implementAssignLayout_Relation2/2 0.127 s 0.127 s 5 BM_implementAssignLayout_Relation3/0 0.227 s 0.227 s 3 BM_implementAssignLayout_Relation3/1 0.026 s 0.026 s 29 BM_implementAssignLayout_Relation3/2 4.32 s 4.31 s 1 BM_implementAssignLayout_HotwordRelationA/0 0.061 s 0.061 s 11 BM_implementAssignLayout_HotwordRelationA/1 0.050 s 0.050 s 13 BM_implementAssignLayout_HotwordRelationA/2 0.453 s 0.453 s 2 BM_implementAssignLayout_HotwordRelationB/0 0.193 s 0.193 s 4 BM_implementAssignLayout_HotwordRelationB/1 0.180 s 0.179 s 4 BM_implementAssignLayout_HotwordRelationB/2 0.279 s 0.279 s 2 BM_implementAssignLayout_HotwordRelationC/0 0.144 s 0.144 s 5 BM_implementAssignLayout_HotwordRelationC/1 0.071 s 0.071 s 11 BM_implementAssignLayout_HotwordRelationC/2 0.139 s 0.139 s 5 BM_implementAssignLayout_HotwordRelationD/0 0.389 s 0.389 s 2 BM_implementAssignLayout_HotwordRelationD/1 0.308 s 0.308 s 2 BM_implementAssignLayout_HotwordRelationD/2 2.43 s 2.43 s 1 ``` After, the benchmark was ``` -------------------------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------------------------- BM_implementAssignLayout_Relation1/0 0.001 s 0.001 s 858 BM_implementAssignLayout_Relation1/1 0.001 s 0.001 s 874 BM_implementAssignLayout_Relation1/2 0.001 s 0.001 s 899 BM_implementAssignLayout_Relation2/0 0.063 s 0.063 s 11 BM_implementAssignLayout_Relation2/1 0.057 s 0.057 s 12 BM_implementAssignLayout_Relation2/2 0.105 s 0.105 s 7 BM_implementAssignLayout_Relation3/0 0.241 s 0.240 s 3 BM_implementAssignLayout_Relation3/1 0.025 s 0.025 s 31 BM_implementAssignLayout_Relation3/2 2.55 s 2.55 s 1 BM_implementAssignLayout_HotwordRelationA/0 0.063 s 0.063 s 10 BM_implementAssignLayout_HotwordRelationA/1 0.057 s 0.057 s 13 BM_implementAssignLayout_HotwordRelationA/2 0.480 s 0.480 s 2 BM_implementAssignLayout_HotwordRelationB/0 0.208 s 0.208 s 3 BM_implementAssignLayout_HotwordRelationB/1 0.201 s 0.201 s 3 BM_implementAssignLayout_HotwordRelationB/2 0.172 s 0.172 s 4 BM_implementAssignLayout_HotwordRelationC/0 0.025 s 0.025 s 28 BM_implementAssignLayout_HotwordRelationC/1 0.071 s 0.071 s 10 BM_implementAssignLayout_HotwordRelationC/2 0.020 s 0.020 s 34 BM_implementAssignLayout_HotwordRelationD/0 0.405 s 0.405 s 2 BM_implementAssignLayout_HotwordRelationD/1 0.327 s 0.327 s 2 BM_implementAssignLayout_HotwordRelationD/2 1.52 s 1.52 s 1 ``` Note that the slowest benchmarks had about a 1.7x speedup. I also added the new relations from the HELRM model (CriteoLayout24 was the slow one, 14M points) BM_implementAssignLayout_CriteoLayout4/0 0.028 s 0.028 s 25 BM_implementAssignLayout_CriteoLayout4/1 0.009 s 0.009 s 76 BM_implementAssignLayout_CriteoLayout4/2 0.765 s 0.765 s 1 BM_implementAssignLayout_CriteoLayout7/0 0.180 s 0.180 s 4 BM_implementAssignLayout_CriteoLayout7/1 0.016 s 0.016 s 45 BM_implementAssignLayout_CriteoLayout7/2 14.2 s 14.2 s 1 BM_implementAssignLayout_CriteoLayout24/0 0.175 s 0.175 s 4 BM_implementAssignLayout_CriteoLayout24/1 0.008 s 0.008 s 87 BM_implementAssignLayout_CriteoLayout24/2 24.4 s 24.4 s 1 PiperOrigin-RevId: 959389656
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Faster enumeration for helrm model
This came up while I was trying to compile the HELRM model. convert-to-ciphertext-semantics was taking 26 minutes to run. This change reduced that to about 2 minutes. The slow point was that the large layout was being explicitly folded in AUTO mode, and it was computing a bounding box of size 10^12 that was iterated over. ISL's native enumeration was much faster.
Before this change: the assign_layout benchmark was
After, the benchmark was
Note that the slowest benchmarks had about a 1.7x speedup.
I also added the new relations from the HELRM model (CriteoLayout24 was the slow one, 14M points)
BM_implementAssignLayout_CriteoLayout4/0 0.028 s 0.028 s 25
BM_implementAssignLayout_CriteoLayout4/1 0.009 s 0.009 s 76
BM_implementAssignLayout_CriteoLayout4/2 0.765 s 0.765 s 1
BM_implementAssignLayout_CriteoLayout7/0 0.180 s 0.180 s 4
BM_implementAssignLayout_CriteoLayout7/1 0.016 s 0.016 s 45
BM_implementAssignLayout_CriteoLayout7/2 14.2 s 14.2 s 1
BM_implementAssignLayout_CriteoLayout24/0 0.175 s 0.175 s 4
BM_implementAssignLayout_CriteoLayout24/1 0.008 s 0.008 s 87
BM_implementAssignLayout_CriteoLayout24/2 24.4 s 24.4 s 1