Handle hipTENSOR 2.4: fix the version decode, reject the layouts it miscomputes - #1065
Merged
Conversation
Contributor
There was a problem hiding this comment.
AMDGPU.jl Benchmarks
Details
| Benchmark suite | Current: 0febfd4 | Previous: 8a165c3 | Ratio |
|---|---|---|---|
amdgpu/synchronization/context/device |
550 ns |
545 ns |
1.01 |
amdgpu/synchronization/stream/blocking |
232.5 ns |
230 ns |
1.01 |
amdgpu/synchronization/stream/nonblocking |
310 ns |
305 ns |
1.02 |
applications/bitonic_sort |
1644020.5 ns |
1602009.25 ns |
1.03 |
applications/convolution |
107476.5 ns |
110114 ns |
0.98 |
applications/floyd_warshall |
11769463.25 ns |
11791724.5 ns |
1.00 |
applications/histogram |
779653.5 ns |
772268 ns |
1.01 |
applications/prefix_sum |
253046.25 ns |
252573.5 ns |
1.00 |
array/accumulate/Float32/1d |
72801 ns |
77508.5 ns |
0.94 |
array/accumulate/Float32/dims=1 |
270053.75 ns |
276093.75 ns |
0.98 |
array/accumulate/Float32/dims=1L |
80783.75 ns |
88671.25 ns |
0.91 |
array/accumulate/Float32/dims=2 |
71091 ns |
81863.75 ns |
0.87 |
array/accumulate/Float32/dims=2L |
2759733.75 ns |
2758274.75 ns |
1.00 |
array/accumulate/Int64/1d |
77183.5 ns |
80568.5 ns |
0.96 |
array/accumulate/Int64/dims=1 |
242468.5 ns |
243593.5 ns |
1.00 |
array/accumulate/Int64/dims=1L |
84061.25 ns |
84163.5 ns |
1.00 |
array/accumulate/Int64/dims=2 |
83556 ns |
87041.25 ns |
0.96 |
array/accumulate/Int64/dims=2L |
3065080.75 ns |
3136242.5 ns |
0.98 |
array/broadcast |
73051 ns |
72426 ns |
1.01 |
array/construct |
2237.5 ns |
2092.75 ns |
1.07 |
array/copy |
37935.75 ns |
37288 ns |
1.02 |
array/copyto!/cpu_to_gpu |
110714 ns |
111639 ns |
0.99 |
array/copyto!/gpu_to_cpu |
120401.75 ns |
111944 ns |
1.08 |
array/copyto!/gpu_to_gpu |
53555.75 ns |
58595.75 ns |
0.91 |
array/iteration/findall/bool |
135012 ns |
136929.25 ns |
0.99 |
array/iteration/findall/int |
149902 ns |
149374.5 ns |
1.00 |
array/iteration/findfirst/bool |
187187.75 ns |
184972.5 ns |
1.01 |
array/iteration/findfirst/int |
164017.25 ns |
144249.25 ns |
1.14 |
array/iteration/findmin/1d |
109871.75 ns |
120894 ns |
0.91 |
array/iteration/findmin/2d |
96051.25 ns |
111526.5 ns |
0.86 |
array/iteration/logical |
240710.75 ns |
244013.25 ns |
0.99 |
array/iteration/scalar |
297699.25 ns |
291824 ns |
1.02 |
array/permutedims/2d |
71858.5 ns |
71388.5 ns |
1.01 |
array/permutedims/3d |
71101 ns |
70801 ns |
1.00 |
array/permutedims/4d |
73563.5 ns |
73643.5 ns |
1.00 |
array/random/rand/Float32 |
45800.5 ns |
45148 ns |
1.01 |
array/random/rand/Int64 |
53845.75 ns |
54070.75 ns |
1.00 |
array/random/rand!/Float32 |
60326 ns |
64578.25 ns |
0.93 |
array/random/rand!/Int64 |
66528.5 ns |
52153.25 ns |
1.28 |
array/random/randn/Float32 |
77931 ns |
80621.25 ns |
0.97 |
array/random/randn!/Float32 |
78403.75 ns |
80881.25 ns |
0.97 |
array/reductions/mapreduce/Float32/1d |
87158.75 ns |
98356.25 ns |
0.89 |
array/reductions/mapreduce/Float32/dims=1 |
81936.25 ns |
85886.25 ns |
0.95 |
array/reductions/mapreduce/Float32/dims=1L |
832621.75 ns |
832188.75 ns |
1.00 |
array/reductions/mapreduce/Float32/dims=2 |
78626.25 ns |
77836 ns |
1.01 |
array/reductions/mapreduce/Float32/dims=2L |
144369.5 ns |
143681.75 ns |
1.00 |
array/reductions/mapreduce/Int64/1d |
86563.75 ns |
99344 ns |
0.87 |
array/reductions/mapreduce/Int64/dims=1 |
82146.25 ns |
88886.25 ns |
0.92 |
array/reductions/mapreduce/Int64/dims=1L |
832046.75 ns |
830456.25 ns |
1.00 |
array/reductions/mapreduce/Int64/dims=2 |
83138.75 ns |
86988.75 ns |
0.96 |
array/reductions/mapreduce/Int64/dims=2L |
144652 ns |
144187 ns |
1.00 |
array/reductions/reduce/Float32/1d |
87238.75 ns |
98423.75 ns |
0.89 |
array/reductions/reduce/Float32/dims=1 |
81931 ns |
88741.25 ns |
0.92 |
array/reductions/reduce/Float32/dims=1L |
826894 ns |
836601.5 ns |
0.99 |
array/reductions/reduce/Float32/dims=2 |
64348.25 ns |
77858.5 ns |
0.83 |
array/reductions/reduce/Float32/dims=2L |
143877 ns |
143437 ns |
1.00 |
array/reductions/reduce/Int64/1d |
86956.25 ns |
97399 ns |
0.89 |
array/reductions/reduce/Int64/dims=1 |
81653.75 ns |
89021.25 ns |
0.92 |
array/reductions/reduce/Int64/dims=1L |
830781.75 ns |
830793.75 ns |
1.00 |
array/reductions/reduce/Int64/dims=2 |
82531.25 ns |
83643.75 ns |
0.99 |
array/reductions/reduce/Int64/dims=2L |
144274.5 ns |
143402 ns |
1.01 |
array/reverse/1d |
45750.75 ns |
45063.25 ns |
1.02 |
array/reverse/1dL |
75896 ns |
74268.5 ns |
1.02 |
array/reverse/1dL_inplace |
80291 ns |
79986.25 ns |
1.00 |
array/reverse/1d_inplace |
39923.25 ns |
39733 ns |
1.00 |
array/reverse/2d |
50470.75 ns |
49965.5 ns |
1.01 |
array/reverse/2dL |
82436.25 ns |
83738.5 ns |
0.98 |
array/reverse/2dL_inplace |
91991.5 ns |
91603.75 ns |
1.00 |
array/reverse/2d_inplace |
63406 ns |
63215.75 ns |
1.00 |
array/sorting/1d |
332429.75 ns |
334934.5 ns |
0.99 |
gemm/tiled |
1913989.25 ns |
1881007.75 ns |
1.02 |
gemm/tiled_unbounded |
1894066.75 ns |
1903723.25 ns |
0.99 |
integration/byval/reference |
39331 ns |
39131 ns |
1.01 |
integration/byval/slices=1 |
41271 ns |
40810 ns |
1.01 |
integration/byval/slices=2 |
128412 ns |
158112 ns |
0.81 |
integration/byval/slices=3 |
235973 ns |
236294 ns |
1.00 |
integration/volumerhs |
4922089 ns |
4909107 ns |
1.00 |
kernel/indexing |
30608 ns |
56803.25 ns |
0.54 |
kernel/indexing_checked |
58920.75 ns |
53248.25 ns |
1.11 |
kernel/launch |
1402.5 ns |
1397.5 ns |
1.00 |
kernel/rand |
98511.5 ns |
100381.25 ns |
0.98 |
latency/import |
1746754092 ns |
1719284175 ns |
1.02 |
latency/precompile |
39936573311 ns |
39908509786 ns |
1.00 |
latency/ttfp |
2313338273 ns |
2329845894 ns |
0.99 |
stencil/diffusion3d |
1625170.25 ns |
1625047 ns |
1.00 |
stencil/diffusion3d_checked |
1662773.25 ns |
1655270 ns |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
Member
Author
|
Changes were comments only. Merging into main in order to have it avail for #1028 |
Member
Author
|
cscs-ci run |
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.
hipTENSOR 2.4 (the version in the ROCm 10.0 bundles) no longer uses the mode labels to line a contraction's operands up. It reads every descriptor positionally, and computes the right result only when the operands are packed column-major and indexed as
A = [M…, K…]— A's free modes, then the contracted onesB = [N…, K…]C = D = [M…, N…]— A's free modes, then B'sEvery other layout is silently miscomputed:
hiptensorContractreturnsHIPTENSOR_STATUS_SUCCESSand writes a plausible but wrong result. hipTENSOR 2.2 handled arbitrary mode orders, which is what the wrapper was written against.Of the 120 shapes
test/hiptensor/contractions.jlgenerates, 115 came out wrong on an MI300A, with relative errors of 0.3–1.2. Reordering the descriptors alone fixes only 80 of them; all 120 are correct once every operand is packed and canonical.Two related changes in 2.4:
HIPTENSOR_OP_CONJon a contraction's input is now rejected —hiptensorCreatePlanfails withHIPTENSOR_STATUS_EXECUTION_FAILED. On 2.2 it was accepted and silently ignored.hiptensorGetVersion()returns2004000, i.e.major * 1_000_000 + minor * 1_000 + patch.version()decoded it cuTENSOR-style and reported the library asv"200.40.0".Changes
version()decode, so hipTENSOR 2.4.0 reportsv"2.4.0"check_contraction_layout, called fromplan_contraction: on hipTENSOR ≥ 2.4, reject any layout the library would miscompute, naming the index order each operand needs. Below 2.4 it returns immediately, so 2.2 is untouched.docs/src/libraries/tensor.mdhipTENSORErrorfromOP_CONJon 2.4, and gain a test asserting the guard firesMaking arbitrary layouts work on 2.4 would mean materialising permuted copies of every operand — a copy of
A,BandCon most calls — so that is left until upstream says whether the layout requirement is intended.Testing
Verified on an MI300A (gfx942) against hipTENSOR 2.4.0 from the ROCm 10.0
gfx94X-dcgpubundle:test/hiptensor/contractions.jlpasses 433/433, no failures or broken tests.Not tested against hipTENSOR 2.2. That path is unchanged by construction.