[KMCompiler][Nvidia] add operator linalg_lu_factor - #4945
Open
YangLong114514 wants to merge 25 commits into
Open
[KMCompiler][Nvidia] add operator linalg_lu_factor#4945YangLong114514 wants to merge 25 commits into
YangLong114514 wants to merge 25 commits into
Conversation
YangLong114514
requested review from
0x45f,
103yiran,
Caeruleann,
bin913,
douxetpur,
hellojack163,
huangyiqun,
tengqm and
w1120029931-bit
as code owners
July 24, 2026 03:58
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as low quality.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
|
/test | linalg_lu_factor:thead |
Collaborator
|
/test | linalg_lu_factor:hygon |
Collaborator
|
/test | linalg_lu_factor:iluvatar |
Collaborator
|
/test | linalg_lu_factor:metax |
This comment was marked as low quality.
This comment was marked as low quality.
Contributor
Test Environment
Test ResultAccuracy ResultSummary
Performance ResultSummary
Benchmark data
📎 Download the full log here |
Contributor
Test Environment
Test ResultAccuracy ResultSummary
Performance ResultSummary
Benchmark data
📎 Download the full log here |
Contributor
Test Environment
Test ResultAccuracy ResultSummary
Performance ResultSummary
Benchmark dataNo performance data collected! 📎 Download the full log here |
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.
PR Category
Operator
Type of Change
Other
Description
Add operator linalg_lu_factor with triton.
Computes the LU decomposition of a matrix with partial pivoting. Given input A (
*, m, n), returns the compact LU matrix and pivot indices (*, min(m,n), int32), satisfying P @ A = L @ U. L is implicitly stored as a unit lower-triangular matrix in the lower part of LU; U is stored in the upper part. Supportspivot=Falseto disable pivoting (CUDA only).Issue
Progress
Performance
test_linalg_lu_factor.py Operator: linalg_lu_factor Performance Test (dtype=torch.float32, mode=kernel,level=comprehensive) Status Torch Latency (ms) Gems Latency (ms) Gems Speedup Size Detail ----------------------------------------------------------------------------------------------- SUCCESS 0.064656 0.021792 2.967 ([torch.Size([16, 16])], {'pivot': True}) SUCCESS 0.070112 0.013632 5.143 ([torch.Size([16, 16])], {'pivot': False}) SUCCESS 0.086528 0.050240 1.722 ([torch.Size([32, 32])], {'pivot': True}) SUCCESS 0.071248 0.029728 2.397 ([torch.Size([32, 32])], {'pivot': False}) SUCCESS 0.127808 0.155072 0.824 ([torch.Size([64, 64])], {'pivot': True}) SUCCESS 0.070944 0.086560 0.820 ([torch.Size([64, 64])], {'pivot': False}) SUCCESS 0.214432 0.583872 0.367 ([torch.Size([128, 128])], {'pivot': True}) SUCCESS 0.097408 0.134176 0.726 ([torch.Size([128, 128])], {'pivot': False}) SUCCESS 0.408256 1.523168 0.268 ([torch.Size([256, 256])], {'pivot': True}) SUCCESS 0.140752 1.028960 0.137 ([torch.Size([256, 256])], {'pivot': False}) SUCCESS 7.762320 2.945776 2.635 ([torch.Size([1024, 512])], {'pivot': True}) SUCCESS 1.893728 1.478832 1.281 ([torch.Size([1024, 512])], {'pivot': False}) SUCCESS 0.107296 0.025232 4.252 ([torch.Size([32, 16])], {'pivot': True}) SUCCESS 0.068832 0.017472 3.940 ([torch.Size([32, 16])], {'pivot': False}) SUCCESS 0.113856 0.025536 4.459 ([torch.Size([16, 32])], {'pivot': True}) SUCCESS 0.075360 0.015904 4.738 ([torch.Size([16, 32])], {'pivot': False}) SUCCESS 0.326016 0.171392 1.902 ([torch.Size([128, 64])], {'pivot': True}) SUCCESS 0.123744 0.078080 1.585 ([torch.Size([128, 64])], {'pivot': False}) SUCCESS 0.367392 0.256448 1.433 ([torch.Size([64, 128])], {'pivot': True}) SUCCESS 0.174848 0.106368 1.644 ([torch.Size([64, 128])], {'pivot': False}) SUCCESS 0.061184 0.050368 1.215 ([torch.Size([4, 32, 32])], {'pivot': True}) SUCCESS 0.052672 0.029792 1.768 ([torch.Size([4, 32, 32])], {'pivot': False}) SUCCESS 0.045312 0.023200 1.953 ([torch.Size([128, 16, 16])], {'pivot': True}) SUCCESS 0.045456 0.014784 3.075 ([torch.Size([128, 16, 16])], {'pivot': False}) SUCCESS 35.109056 37.323967 0.941 ([torch.Size([1024, 512, 512])], {'pivot': True}) SUCCESS 18.171968 26.555040 0.684 ([torch.Size([1024, 512, 512])], {'pivot': False}) SUCCESS 128.263489 144.178818 0.890 ([torch.Size([4096, 512, 512])], {'pivot': True}) SUCCESS 66.834274 103.271805 0.647 ([torch.Size([4096, 512, 512])], {'pivot': False}) Operator: linalg_lu_factor Performance Test (dtype=torch.float64, mode=kernel,level=comprehensive) Status Torch Latency (ms) Gems Latency (ms) Gems Speedup Size Detail ----------------------------------------------------------------------------------------------- SUCCESS 0.071872 0.026912 2.671 ([torch.Size([16, 16])], {'pivot': True}) SUCCESS 0.101792 0.019392 5.249 ([torch.Size([16, 16])], {'pivot': False}) SUCCESS 0.095360 0.057760 1.651 ([torch.Size([32, 32])], {'pivot': True}) SUCCESS 0.103712 0.037824 2.742 ([torch.Size([32, 32])], {'pivot': False}) SUCCESS 0.145952 0.172736 0.845 ([torch.Size([64, 64])], {'pivot': True}) SUCCESS 0.112928 0.128352 0.880 ([torch.Size([64, 64])], {'pivot': False}) SUCCESS 0.261568 0.729184 0.359 ([torch.Size([128, 128])], {'pivot': True}) SUCCESS 0.291440 0.279744 1.042 ([torch.Size([128, 128])], {'pivot': False}) SUCCESS 0.647136 1.605216 0.403 ([torch.Size([256, 256])], {'pivot': True}) SUCCESS 0.703360 1.191024 0.591 ([torch.Size([256, 256])], {'pivot': False}) SUCCESS 9.551360 4.537216 2.105 ([torch.Size([1024, 512])], {'pivot': True}) SUCCESS 3.759536 1.695520 2.217 ([torch.Size([1024, 512])], {'pivot': False}) SUCCESS 0.129872 0.030464 4.263 ([torch.Size([32, 16])], {'pivot': True}) SUCCESS 0.076320 0.020864 3.658 ([torch.Size([32, 16])], {'pivot': False}) SUCCESS 0.129696 0.036640 3.540 ([torch.Size([16, 32])], {'pivot': True}) SUCCESS 0.084368 0.024736 3.411 ([torch.Size([16, 32])], {'pivot': False}) SUCCESS 0.388000 0.237184 1.636 ([torch.Size([128, 64])], {'pivot': True}) SUCCESS 0.166528 0.160096 1.040 ([torch.Size([128, 64])], {'pivot': False}) SUCCESS 0.423264 0.282880 1.496 ([torch.Size([64, 128])], {'pivot': True}) SUCCESS 0.216224 0.177024 1.221 ([torch.Size([64, 128])], {'pivot': False}) SUCCESS 0.078624 0.058016 1.355 ([torch.Size([4, 32, 32])], {'pivot': True}) SUCCESS 0.062784 0.037920 1.656 ([torch.Size([4, 32, 32])], {'pivot': False}) SUCCESS 0.061088 0.032512 1.879 ([torch.Size([128, 16, 16])], {'pivot': True}) SUCCESS 0.058272 0.022528 2.587 ([torch.Size([128, 16, 16])], {'pivot': False}) SUCCESS 191.890244 38.351360 5.003 ([torch.Size([1024, 512, 512])], {'pivot': True}) SUCCESS 171.316925 30.698463 5.581 ([torch.Size([1024, 512, 512])], {'pivot': False}) SUCCESS 751.502991 148.350876 5.066 ([torch.Size([4096, 512, 512])], {'pivot': True}) SUCCESS 669.608276 119.028770 5.626 ([torch.Size([4096, 512, 512])], {'pivot': False}) Operator: linalg_lu_factor_out Performance Test (dtype=torch.float32, mode=kernel,level=comprehensive) Status Torch Latency (ms) Gems Latency (ms) Gems Speedup Size Detail ----------------------------------------------------------------------------------------------- SUCCESS 0.061440 0.021760 2.824 ([torch.Size([16, 16])], {'pivot': True, 'out': [torch.Size([16, 16]), torch.Size([16])]}) SUCCESS 0.073440 0.013696 5.362 ([torch.Size([16, 16])], {'pivot': False, 'out': [torch.Size([16, 16]), torch.Size([16])]}) SUCCESS 0.083520 0.050208 1.663 ([torch.Size([32, 32])], {'pivot': True, 'out': [torch.Size([32, 32]), torch.Size([32])]}) SUCCESS 0.073120 0.029536 2.476 ([torch.Size([32, 32])], {'pivot': False, 'out': [torch.Size([32, 32]), torch.Size([32])]}) SUCCESS 0.125184 0.154720 0.809 ([torch.Size([64, 64])], {'pivot': True, 'out': [torch.Size([64, 64]), torch.Size([64])]}) SUCCESS 0.072992 0.086368 0.845 ([torch.Size([64, 64])], {'pivot': False, 'out': [torch.Size([64, 64]), torch.Size([64])]}) SUCCESS 0.215104 0.579808 0.371 ([torch.Size([128, 128])], {'pivot': True, 'out': [torch.Size([128, 128]), torch.Size([128])]}) SUCCESS 0.097888 0.134176 0.730 ([torch.Size([128, 128])], {'pivot': False, 'out': [torch.Size([128, 128]), torch.Size([128])]}) SUCCESS 0.405440 1.527488 0.265 ([torch.Size([256, 256])], {'pivot': True, 'out': [torch.Size([256, 256]), torch.Size([256])]}) SUCCESS 0.139648 1.032560 0.135 ([torch.Size([256, 256])], {'pivot': False, 'out': [torch.Size([256, 256]), torch.Size([256])]}) SUCCESS 7.353504 2.930576 2.509 ([torch.Size([1024, 512])], {'pivot': True, 'out': [torch.Size([1024, 512]), torch.Size([512])]}) SUCCESS 1.842512 1.619568 1.138 ([torch.Size([1024, 512])], {'pivot': False, 'out': [torch.Size([1024, 512]), torch.Size([512])]}) SUCCESS 0.109184 0.025536 4.276 ([torch.Size([32, 16])], {'pivot': True, 'out': [torch.Size([32, 16]), torch.Size([16])]}) SUCCESS 0.074496 0.017792 4.187 ([torch.Size([32, 16])], {'pivot': False, 'out': [torch.Size([32, 16]), torch.Size([16])]}) SUCCESS 0.116928 0.025472 4.590 ([torch.Size([16, 32])], {'pivot': True, 'out': [torch.Size([16, 32]), torch.Size([16])]}) SUCCESS 0.078176 0.015968 4.896 ([torch.Size([16, 32])], {'pivot': False, 'out': [torch.Size([16, 32]), torch.Size([16])]}) SUCCESS 0.321904 0.170880 1.884 ([torch.Size([128, 64])], {'pivot': True, 'out': [torch.Size([128, 64]), torch.Size([64])]}) SUCCESS 0.127680 0.109760 1.163 ([torch.Size([128, 64])], {'pivot': False, 'out': [torch.Size([128, 64]), torch.Size([64])]}) SUCCESS 0.361056 0.256352 1.408 ([torch.Size([64, 128])], {'pivot': True, 'out': [torch.Size([64, 128]), torch.Size([64])]}) SUCCESS 0.175536 0.110240 1.592 ([torch.Size([64, 128])], {'pivot': False, 'out': [torch.Size([64, 128]), torch.Size([64])]}) SUCCESS 0.064592 0.050016 1.291 ([torch.Size([4, 32, 32])], {'pivot': True, 'out': [torch.Size([4, 32, 32]), torch.Size([4, 32])]}) SUCCESS 0.054816 0.029632 1.850 ([torch.Size([4, 32, 32])], {'pivot': False, 'out': [torch.Size([4, 32, 32]), torch.Size([4, 32])]}) SUCCESS 0.048768 0.023136 2.108 ([torch.Size([128, 16, 16])], {'pivot': True, 'out': [torch.Size([128, 16, 16]), torch.Size([128, 16])]}) SUCCESS 0.046656 0.014624 3.190 ([torch.Size([128, 16, 16])], {'pivot': False, 'out': [torch.Size([128, 16, 16]), torch.Size([128, 16])]}) SUCCESS 38.076351 37.257504 1.022 ([torch.Size([1024, 512, 512])], {'pivot': True, 'out': [torch.Size([1024, 512, 512]), torch.Size([1024, 512])]}) SUCCESS 20.318992 26.447680 0.768 ([torch.Size([1024, 512, 512])], {'pivot': False, 'out': [torch.Size([1024, 512, 512]), torch.Size([1024, 512])]}) SUCCESS 135.640930 143.988678 0.942 ([torch.Size([4096, 512, 512])], {'pivot': True, 'out': [torch.Size([4096, 512, 512]), torch.Size([4096, 512])]}) SUCCESS 75.481506 103.056580 0.732 ([torch.Size([4096, 512, 512])], {'pivot': False, 'out': [torch.Size([4096, 512, 512]), torch.Size([4096, 512])]}) Operator: linalg_lu_factor_out Performance Test (dtype=torch.float64, mode=kernel,level=comprehensive) Status Torch Latency (ms) Gems Latency (ms) Gems Speedup Size Detail ----------------------------------------------------------------------------------------------- SUCCESS 0.068032 0.096512 0.705 ([torch.Size([16, 16])], {'pivot': True, 'out': [torch.Size([16, 16]), torch.Size([16])]}) SUCCESS 0.098112 0.088672 1.106 ([torch.Size([16, 16])], {'pivot': False, 'out': [torch.Size([16, 16]), torch.Size([16])]}) SUCCESS 0.092448 0.109280 0.846 ([torch.Size([32, 32])], {'pivot': True, 'out': [torch.Size([32, 32]), torch.Size([32])]}) SUCCESS 0.105888 0.105376 1.005 ([torch.Size([32, 32])], {'pivot': False, 'out': [torch.Size([32, 32]), torch.Size([32])]}) SUCCESS 0.149472 0.172576 0.866 ([torch.Size([64, 64])], {'pivot': True, 'out': [torch.Size([64, 64]), torch.Size([64])]}) SUCCESS 0.114208 0.128576 0.888 ([torch.Size([64, 64])], {'pivot': False, 'out': [torch.Size([64, 64]), torch.Size([64])]}) SUCCESS 0.264032 0.729216 0.362 ([torch.Size([128, 128])], {'pivot': True, 'out': [torch.Size([128, 128]), torch.Size([128])]}) SUCCESS 0.287456 0.280192 1.026 ([torch.Size([128, 128])], {'pivot': False, 'out': [torch.Size([128, 128]), torch.Size([128])]}) SUCCESS 0.649664 1.600832 0.406 ([torch.Size([256, 256])], {'pivot': True, 'out': [torch.Size([256, 256]), torch.Size([256])]}) SUCCESS 0.705216 1.190208 0.593 ([torch.Size([256, 256])], {'pivot': False, 'out': [torch.Size([256, 256]), torch.Size([256])]}) SUCCESS 9.250032 4.519264 2.047 ([torch.Size([1024, 512])], {'pivot': True, 'out': [torch.Size([1024, 512]), torch.Size([512])]}) SUCCESS 3.758384 1.586720 2.369 ([torch.Size([1024, 512])], {'pivot': False, 'out': [torch.Size([1024, 512]), torch.Size([512])]}) SUCCESS 0.121536 0.098560 1.233 ([torch.Size([32, 16])], {'pivot': True, 'out': [torch.Size([32, 16]), torch.Size([16])]}) SUCCESS 0.079360 0.089728 0.884 ([torch.Size([32, 16])], {'pivot': False, 'out': [torch.Size([32, 16]), torch.Size([16])]}) SUCCESS 0.132512 0.105264 1.259 ([torch.Size([16, 32])], {'pivot': True, 'out': [torch.Size([16, 32]), torch.Size([16])]}) SUCCESS 0.088544 0.092096 0.961 ([torch.Size([16, 32])], {'pivot': False, 'out': [torch.Size([16, 32]), torch.Size([16])]}) SUCCESS 0.386208 0.236736 1.631 ([torch.Size([128, 64])], {'pivot': True, 'out': [torch.Size([128, 64]), torch.Size([64])]}) SUCCESS 0.213312 0.159936 1.334 ([torch.Size([128, 64])], {'pivot': False, 'out': [torch.Size([128, 64]), torch.Size([64])]}) SUCCESS 0.420032 0.283184 1.483 ([torch.Size([64, 128])], {'pivot': True, 'out': [torch.Size([64, 128]), torch.Size([64])]}) SUCCESS 0.217696 0.176960 1.230 ([torch.Size([64, 128])], {'pivot': False, 'out': [torch.Size([64, 128]), torch.Size([64])]}) SUCCESS 0.080128 0.116608 0.687 ([torch.Size([4, 32, 32])], {'pivot': True, 'out': [torch.Size([4, 32, 32]), torch.Size([4, 32])]}) SUCCESS 0.064160 0.111680 0.574 ([torch.Size([4, 32, 32])], {'pivot': False, 'out': [torch.Size([4, 32, 32]), torch.Size([4, 32])]}) SUCCESS 0.064768 0.108400 0.597 ([torch.Size([128, 16, 16])], {'pivot': True, 'out': [torch.Size([128, 16, 16]), torch.Size([128, 16])]}) SUCCESS 0.055872 0.096192 0.581 ([torch.Size([128, 16, 16])], {'pivot': False, 'out': [torch.Size([128, 16, 16]), torch.Size([128, 16])]}) SUCCESS 194.085022 38.248032 5.074 ([torch.Size([1024, 512, 512])], {'pivot': True, 'out': [torch.Size([1024, 512, 512]), torch.Size([1024, 512])]}) SUCCESS 171.838211 30.832191 5.573 ([torch.Size([1024, 512, 512])], {'pivot': False, 'out': [torch.Size([1024, 512, 512]), torch.Size([1024, 512])]}) SUCCESS 760.495239 148.134521 5.134 ([torch.Size([4096, 512, 512])], {'pivot': True, 'out': [torch.Size([4096, 512, 512]), torch.Size([4096, 512])]}) SUCCESS 678.771606 118.811234 5.713 ([torch.Size([4096, 512, 512])], {'pivot': False, 'out': [torch.Size([4096, 512, 512]), torch.Size([4096, 512])]})