torch-hungarian 0.1.0rc0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0rc0 - 2026-08-20
4
+
5
+ ### Added
6
+
7
+ - Add a lazy Triton CUDA backend for Linux NVIDIA GPUs with compute capability 8.0 or newer and Torch 2.4 or newer.
8
+ - Add exact SciPy parity, dtype, autocast, non-finite input, non-default stream, and large-batch regression coverage for the Triton solver.
9
+ - Add reproducible author-run GPU validation and JSONL benchmark reporting with paired SciPy and legacy `0.0.6` comparisons.
10
+
11
+ ### Changed
12
+
13
+ - Ship a pure-source package by default; normal installation no longer compiles the legacy CUDA extension.
14
+ - Require Python 3.10 or newer.
15
+ - Preserve `float64` solver precision, promote `float16`, `bfloat16`, and integer inputs to `float32`, and match SciPy's infeasible and invalid-cost behavior.
16
+ - Fall back to SciPy on unsupported CUDA runtimes and return the assignment to the input device.
17
+
18
+ ### Migration
19
+
20
+ - Existing `batch_linear_assignment` and `assignment_to_indices` calls do not require API changes.
21
+ - Users who require the compiled CUDA implementation, including execution on T4 (`sm_75`), should remain on the maintenance-only `0.0.x` release line. Release `0.0.6` can be installed with `python -m pip install "torch-linear-assignment==0.0.6"`.
22
+ - The Triton path requires Linux, an NVIDIA GPU with compute capability 8.0 or newer, Torch 2.4 or newer, and Triton. Other supported environments continue through SciPy.
23
+
24
+ ### Validation status
25
+
26
+ - Exact assignment parity and all GPU tests pass on NVIDIA L4 (`sm_89`), A100 (`sm_80`), and RTX PRO 6000 Blackwell (`sm_120`) author-run environments.
27
+ - H100 validation and isolated fresh-process cold-start measurements remain pending. Published warm timings are paired with same-machine SciPy and legacy baselines; they are not generalized across hardware.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,35 @@
1
+ # Manifest syntax https://packaging.python.org/en/latest/guides/using-manifest-in/
2
+ #graft wheelhouse
3
+
4
+ recursive-exclude __pycache__ *.py[cod] *.orig
5
+ recursive-include torch_linear_assignment *.py
6
+ recursive-include src *.cpp
7
+ recursive-include src *.cu
8
+
9
+ # Include the README and CHANGELOG
10
+ include *.md
11
+
12
+ # Include the license file
13
+ include LICENSE
14
+
15
+
16
+ # exclude tests from package
17
+ recursive-exclude tests *
18
+ recursive-exclude site *
19
+ exclude tests
20
+
21
+ # Include the Requirements
22
+ include requirements.txt
23
+
24
+ # Include build dependencies
25
+ include pyproject.toml
26
+
27
+ # Exclude build configs
28
+ exclude *.sh
29
+ exclude *.yml
30
+ exclude *.yaml
31
+ exclude Makefile
32
+
33
+ prune .devcontainer
34
+ prune .git
35
+ prune .github
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: torch-hungarian
3
+ Version: 0.1.0rc0
4
+ Summary: Batched linear assignment with PyTorch and CUDA.
5
+ Author: Ivan Karpukhin
6
+ Author-email: karpuhini@yandex.ru
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: torch>=1.12.0
11
+ Requires-Dist: scipy>=1.6.0
12
+ Requires-Dist: triton; platform_system == "Linux"
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: license-file
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ # Batch linear assignment for PyTorch
23
+
24
+ [![PyPI version](https://badge.fury.io/py/torch-linear-assignment.svg)](https://badge.fury.io/py/torch-linear-assignment) [![Build Status](https://github.com/ivan-chai/torch-linear-assignment/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/ivan-chai/torch-linear-assignment/actions) [![Downloads](https://img.shields.io/pypi/dm/torch-linear-assignment)](https://pepy.tech/project/torch-linear-assignment) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
25
+
26
+ <h4 align="left">
27
+ <p>
28
+ <a href="#install">Installation</a> |
29
+ <a href="#backend-and-release-policy">Backend policy</a> |
30
+ <a href="#example">Usage</a> |
31
+ <a href="#support">Support</a> |
32
+ <a href="#legacy-cuda-implementation-00x">Legacy CUDA</a> |
33
+ <a href="#acknowledgments">Acknowledgments</a> |
34
+ <a href="#citation">Citation</a>
35
+ <p>
36
+ </h4>
37
+ Batch computation of the linear assignment problem with PyTorch. The active
38
+ `0.1.0+` release line is pure source: CPU calls use SciPy, and supported CUDA
39
+ calls use the lazy Triton backend.
40
+
41
+ ## Backend and release policy
42
+
43
+ The active release line is `0.1.0+`. It uses Triton on validated Linux NVIDIA GPUs with compute capability 8.0 or newer and SciPy everywhere else. Unsupported CUDA inputs are solved by the SciPy CPU fallback and returned to the input device. The compiled CUDA extension belongs to the maintenance-only `0.0.x` line and is documented separately in [Legacy CUDA implementation (`0.0.x`)](#legacy-cuda-implementation-00x). If that backend needs a compatibility or correctness fix, the project can issue another `0.0.x` release without adopting the Triton overhaul.
44
+
45
+ ## Install
46
+
47
+ Python 3.10 or newer is required. Install the `0.1.0` release candidate from PyPI:
48
+
49
+ ```bash
50
+ python -m pip install "torch-linear-assignment==0.1.0rc0"
51
+ ```
52
+
53
+ No editable install, local CUDA compilation, or `--no-build-isolation` flag is needed for normal use. On Linux, the package declares Triton through a platform marker and imports it lazily only for an eligible CUDA input. macOS and Windows installs remain usable through SciPy without requiring Triton.
54
+
55
+ ## Example
56
+
57
+ ```python
58
+ import torch
59
+ from torch_linear_assignment import batch_linear_assignment
60
+
61
+ cost = torch.tensor([
62
+ 8, 4, 7,
63
+ 5, 2, 3,
64
+ 9, 6, 7,
65
+ 9, 4, 8,
66
+ ]).reshape(1, 4, 3)
67
+
68
+ assignment = batch_linear_assignment(cost)
69
+ print(assignment)
70
+ ```
71
+
72
+ The output is:
73
+
74
+ ```py
75
+ tensor([[ 0, 2, -1, 1]])
76
+ ```
77
+
78
+ To get indices in the SciPy's format:
79
+
80
+ ```py
81
+ from torch_linear_assignment import assignment_to_indices
82
+
83
+ row_ind, col_ind = assignment_to_indices(assignment)
84
+ print(row_ind)
85
+ print(col_ind)
86
+ ```
87
+
88
+ The output is:
89
+
90
+ ```py
91
+ tensor([[0, 1, 3]])
92
+ tensor([[0, 2, 1]])
93
+ ```
94
+
95
+ ## Support
96
+
97
+ The public API is `batch_linear_assignment(cost)` with cost shape `(B, W, T)`. Assignments have shape `(B, W)`, use `torch.long`, and contain `-1` for an unmatched worker.
98
+
99
+ | Input and runtime | Backend and behavior |
100
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
101
+ | CPU input on any supported OS | SciPy on CPU. This remains the reference path. |
102
+ | Linux NVIDIA GPU with compute capability 8.0 or newer, Torch >= 2.4, and Triton available | Lazy Triton CUDA backend. The first call can include Triton compilation. |
103
+ | CUDA input on an unsupported OS; non-NVIDIA Linux accelerator; NVIDIA GPU below compute capability 8.0 (including T4); or missing/ineligible Triton/Torch | Warn once, solve with SciPy on CPU, and return the assignment on the input device. |
104
+
105
+ The solver promotes `float16`, `bfloat16`, and integer costs to `float32`; `float64` costs remain `float64`. Triton execution disables autocast, so precision already lost before entry cannot be recovered.
106
+
107
+ Non-finite costs follow the SciPy contract. `NaN` and `-inf` raise `ValueError("matrix contains invalid numeric entries")`. `+inf` represents a forbidden edge when a perfect matching still exists; if the matrix is infeasible, the call raises `ValueError("cost matrix is infeasible")` instead of terminating the process with a device assertion.
108
+
109
+ ## Validation and performance status
110
+
111
+ GPU validation is author-run rather than hosted CI. The validation targets are Linux NVIDIA GPUs with compute capability 8.0 or newer (for example, L4, A100, H100, or RTX PRO 6000 Blackwell):
112
+
113
+ ```bash
114
+ make validate # correctness once; prints GPU metadata when available
115
+ make benchmark # SciPy CPU and installed public CUDA; writes JSONL and a cold/warm table
116
+ ```
117
+
118
+ `make validate` prints Python/platform, Torch/CUDA, Triton, and GPU compute capability metadata when a CUDA device is visible. `make benchmark` separately measures the SciPy CPU reference and installed public CUDA backend, writes complete JSONL evidence, and prints a compact cold/warm table. A clean GPU metadata skip on macOS or a machine without CUDA is expected, but is not GPU evidence.
119
+
120
+ The first Triton call may be slower because it includes cold compilation; measure cold compilation separately from warm execution. Do not generalize performance across GPU models or workloads. The active `0.1.0+` line requires the correctness, AMP/dtype, fallback, packaging, GPU, and warm-performance gates to pass on each advertised GPU class.
121
+
122
+ Author-run evidence captured on 2026-08-20 at commit `eee95ffc` (`perf(triton): terminate completed augmentations early`) supports this matrix:
123
+
124
+ | GPU | SciPy reference comparison | Triton validation |
125
+ | ---------------------------------------- | ------------------------------- | ------------------ |
126
+ | NVIDIA L4 (`sm_89`) | Exact in all 30 benchmark cases | `78/78` tests pass |
127
+ | NVIDIA A100 (`sm_80`) | Exact in all 30 benchmark cases | `78/78` tests pass |
128
+ | NVIDIA H100 (`sm_90`) | ? | ? |
129
+ | NVIDIA RTX PRO 6000 Blackwell (`sm_120`) | Exact in all 30 benchmark cases | `78/78` tests pass |
130
+
131
+ Representative batch-208 float32 performance is shown below. Each timing cell is `transpose / square / direct` in milliseconds for `300 x 100`, `300 x 300`, and `300 x 600`. Ratios above `1.0x` mean Triton is faster. Values are rounded to one decimal; `~` marks ratios derived from the displayed timings.
132
+
133
+ | GPU / timing | SciPy CPU (ms) | Triton (ms) | SciPy / Triton |
134
+ | ------------------ | -------------------- | ---------------- | ----------------------- |
135
+ | L4 (first\*) | 71.8 / 788.6 / 421.9 | 1.0 / 7.6 / 4.3 | ~71.8x / 103.8x / 98.1x |
136
+ | L4 (warm) | 71.3 / 782.5 / 422.8 | 1.0 / 7.6 / 4.4 | 71.3x / 103.5x / 96.4x |
137
+ | A100 (first\*) | 74.8 / 788.6 / 430.3 | 1.3 / 11.6 / 4.3 | ~57.5x / 68.0x / 100.1x |
138
+ | A100 (warm) | 73.9 / 788.4 / 431.9 | 1.3 / 11.6 / 4.4 | 56.7x / 67.7x / 99.1x |
139
+ | H100 (first\*) | ? | ? | ? |
140
+ | H100 (warm) | ? | ? | ? |
141
+ | RTX 6000 (first\*) | 32.1 / 409.8 / 204.8 | 0.7 / 5.5 / 2.2 | ~45.9x / 74.5x / 93.1x |
142
+ | RTX 6000 (warm) | 32.3 / 410.1 / 204.8 | 0.5 / 5.4 / 2.2 | 60.8x / 75.8x / 94.4x |
143
+
144
+ The Triton implementation parallelizes batch items and vectorizes each current candidate-column scan. Commit `eee95ffc` also terminates the shortest-path search when an augmentation finds an unmatched sink. This removes the post-completion iterations that dominated direct matrices. Against the same-machine SciPy CPU reference, representative warm Triton speedups span `56.7x`--`103.5x` while retaining exact assignment parity.
145
+
146
+ `first*` means the first call for that case in the shared benchmark process. It is not an isolated compilation measurement: earlier shapes and dtypes can populate driver, process, and Triton disk caches. The three notebooks also predate the fresh-process benchmark-integrity harness, so these measurements are provisional author-run evidence rather than the final cold-performance record. Publication-grade cold claims require a source-bound, five-process rerun.
147
+
148
+ Do not publish a Triton-only timing as a speedup. Each performance report pairs the same seeded workload with its same-machine SciPy CPU baseline.
149
+
150
+ For direct benchmark-script options, the underlying command writes complete JSONL evidence to a run-specific file and prints a compact table containing the backend, validation mode, shape, status, cold/warm latency, and exact-parity result:
151
+
152
+ ```bash
153
+ make benchmark
154
+ python tests/benchmark.py --backends scipy,public_cuda --output benchmark-results.jsonl
155
+ ```
156
+
157
+ The command exits nonzero if any invocation fails exact parity. The JSONL file retains replay diagnostics that the console table intentionally omits.
158
+
159
+ ## Legacy CUDA implementation (`0.0.x`)
160
+
161
+ Release `0.0.6` contains the frozen, compiled plain-CUDA implementation. It is not the active default and should be pinned only when that legacy GPU path is explicitly required, including T4 (`sm_75`) execution:
162
+
163
+ ```bash
164
+ python -m pip install "torch-linear-assignment==0.0.6"
165
+ ```
166
+
167
+ The extension needs a compatible CUDA build environment and must include `sm_75`; the project does not promise a portable T4 wheel. Pinning it is also workload-dependent: in the recorded T4 comparison, SciPy was faster through batch 50, while legacy CUDA was materially faster for the tested batch-208 transpose and direct cases.
168
+
169
+ For a private contributor comparison from a current checkout, the legacy extension can instead be built explicitly:
170
+
171
+ ```bash
172
+ TLA_BUILD_LEGACY_CUDA=1 python -m pip install -e . --no-build-isolation
173
+ ```
174
+
175
+ This opt-in is not required for normal `0.1.0+` use and does not expose a public backend selector. For a clean cross-version benchmark, copy `tests/benchmark.py` outside the checkout first. In a separate baseline environment, `make install-legacy` installs the newest PyPI release matching `torch-linear-assignment<0.1.0`; the copied runner then measures its installed public CUDA backend. Pair those results with the same shapes, dtypes, seed, GPU, and validation mode from the current Triton run.
176
+
177
+ The following author-run batch-208 FP32 comparison uses the same `transpose / square / direct` ordering as the main table. Ratios above `1.0x` mean Triton is faster; values are rounded to one decimal, and `~` marks ratios derived from separately displayed legacy and current-package timings.
178
+
179
+ | GPU / timing | Legacy 0.0.6 (ms) | Triton (ms) | Legacy / Triton |
180
+ | ------------------ | -------------------- | ---------------- | ------------------------ |
181
+ | T4 (first\*) | 37.0 / 879.5 / 273.9 | — | — |
182
+ | T4 (warm) | 37.7 / 738.6 / 272.6 | — | — |
183
+ | L4 (first\*) | 37.9 / 648.5 / 274.5 | 1.0 / 7.6 / 4.3 | ~37.9x / 85.3x / 63.8x |
184
+ | L4 (warm) | 37.8 / 652.5 / 273.3 | 1.0 / 7.6 / 4.4 | ~37.8x / 85.9x / 62.1x |
185
+ | A100 (first\*) | 36.2 / 755.5 / 271.7 | 1.3 / 11.6 / 4.3 | ~27.8x / 65.1x / 63.2x |
186
+ | A100 (warm) | 36.2 / 731.3 / 271.6 | 1.3 / 11.6 / 4.4 | ~27.8x / 63.0x / 61.7x |
187
+ | H100 (first\*) | ? | ? | ? |
188
+ | H100 (warm) | ? | ? | ? |
189
+ | RTX 6000 (first\*) | 35.4 / 607.1 / 248.0 | 0.7 / 5.5 / 2.2 | ~50.6x / 110.4x / 112.7x |
190
+ | RTX 6000 (warm) | 35.4 / 607.6 / 249.3 | 0.5 / 5.4 / 2.2 | ~70.8x / 112.5x / 113.3x |
191
+
192
+ Triton is faster in all 30 paired warm cases on each measured supported GPU; the weakest displayed ratio is about `6.0x`. T4 has no Triton timing because it is below the supported compute capability, and H100 remains unmeasured. The `first*` caveat from the main table applies equally here.
193
+
194
+ ## Acknowledgments
195
+
196
+ The `0.1.0+` pure-source Triton backend, GPU validation workflow, and benchmark revamp were implemented by [@Borda](https://github.com/Borda).
197
+
198
+ ## Citation
199
+
200
+ The code was originally developed for the [HoTPP Benchmark](https://github.com/ivan-chai/hotpp-benchmark). If you use this code in your research project, please cite one of the following papers:
201
+
202
+ ```
203
+ @article{karpukhin2024hotppbenchmark,
204
+ title={HoTPP Benchmark: Are We Good at the Long Horizon Events Forecasting?},
205
+ author={Karpukhin, Ivan and Shipilov, Foma and Savchenko, Andrey},
206
+ journal={arXiv preprint arXiv:2406.14341},
207
+ year={2024},
208
+ url ={https://arxiv.org/abs/2406.14341}
209
+ }
210
+
211
+ @article{karpukhin2024detpp,
212
+ title={DeTPP: Leveraging Object Detection for Robust Long-Horizon Event Prediction},
213
+ author={Karpukhin, Ivan and Savchenko, Andrey},
214
+ journal={arXiv preprint arXiv:2408.13131},
215
+ year={2024},
216
+ url ={https://arxiv.org/abs/2408.13131}
217
+ }
218
+ ```