-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Batched SVD_LOWRANK being much slower than loop implementation (both CPU and GPU) #56891
Copy link
Copy link
Open
Labels
module: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulmodule: performanceIssues related to performance, either of kernel code or framework glueIssues related to performance, either of kernel code or framework gluetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
module: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulmodule: performanceIssues related to performance, either of kernel code or framework glueIssues related to performance, either of kernel code or framework gluetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Issue description
I've found the
torch.svd_lowrankto be up to 2x slower in CPU and GPU for the batched implementation when compared to a loop implementation.I guess if then the bacthed implemenation could be turned into a loop one so it is faster.
Note: i have found batched and loop implementations to be on par for low matrix sizes (n<2000 for n x n matrices), but very different for big sizes (both in cpu and gpu)
Code example
System Info
I run the script both in a MacBook Pro (torch cpu) and in colab (cuda) with the same results.
cc @jianyuh @nikitaved @pearu @mruberry @heitorschueroff @walterddr @IvanYashchuk @xwang233 @lezcano @rgommers @VitalyFedyunin @ngimel