Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kends Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- cuTENSOR: check the indices and sizes of the arguments, and handle empty outputs, contractions and traces over dimensions of size zero, and traces without traced indices - TBLIS: handle traces over dimensions of size zero - StridedNative: reject outputs that alias an input of a contraction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every backend is compared to BaseCopy on CPU copies of the inputs, which is itself compared to plain loop implementations. Backends of other array types, e.g. GPU arrays, are therefore compared to CPU results. The test suite replaces the per-backend tests of the primitive operations, and adds many more edge cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Adds a reusable test suite for TensorOperations backends, in the spirit of the GPUArrays.jl and MatrixAlgebraKit.jl test suites, and fixes the bugs it found in the backends. Stacked on #320.
Test suite
test/testsuite/TestSuite.jlteststensoradd!,tensortrace!,tensorcontract!and their allocating versions for a given backend:BaseCopy()by default, run on CPU copies of the same inputs, so GPU backends are checked against CPU results.BaseCopyitself is checked against straightforward loop implementations (TestSuite.LoopReference()).TestSuite.Optionsfields describe what a backend supports: views, negative strides,Adjoint/Transposeinputs, size-zero dimensions,Diagonalarguments, rejecting aliased outputs, and the combinations of mixed element types to test (()for none).Cfilled withNaNwheneverβis zero, to check strong-zero semantics, for bothZero()and numeric zerosOne()/Zero()and a zeroαAdjoint/Transposeinputs, combined withconjADiagonalarguments, including diagonal-times-diagonal into aDiagonalBigFloattest/core/backends/:BaseCopy,BaseView,StridedNative,StridedBLAS(also with the manual and buffer allocators) andDefaultBackend.extensions/tblis.jl: TBLIS.extensions/gpuarrays.jl: the Strided backends onJLArray/CuArray, and cuTENSOR andDefaultBackendonCuArray.methods.jl,tblis.jlandgpuarrays.jlthat the suite covers.Bugs found and fixed
BaseCopy,BaseViewBoundsErrorNaNor an unscaled resultStridedNativeDefaultBackendonCuArrayThe size-zero cases with an output that may not be read are handled through a shared
_scale!helper, which overwritesCforβ = 0.Not supported, and switched off through the options: mixed element types and negative strides for cuTENSOR, mixed element types for TBLIS, and
Diagonalarguments forStridedBLAS.Other changes
test/Project.toml(with[workspace]and[sources]), as in TensorKit and MatrixAlgebraKit.StridedBLASonCuArrayneeds Strided's cuBLAS extension.ci.ymlexcludestestsuitefrom the test groups, andruntests.jlskips the suite's own files.Strided
Requires Strided v2.6.7 (QuantumKitHub/Strided.jl#100): before that,
StridedBLAScontractions over a size-zero dimension leftNaNs forβ = 0(conjugated complex and non-BLAS element types), and failed onCuArray. The compat bound is raised to 2.6.7 in bothProject.tomlandtest/Project.toml.Testing
All suites pass locally with Julia 1.13, including on a local GPU (the
core/backends/strided.jlsuite also rerun against the released Strided v2.6.7). Each file was run in its own module through a scratch script, not throughruntests.jl:core/backends/basecopy.jlcore/backends/baseview.jlcore/backends/strided.jlcore/backends/default.jlcore/methods.jlextensions/tblis.jlextensions/gpuarrays.jl(JLArrayandCuArray)The suite is compile-heavy: the
coregroup takes noticeably longer than before.🤖 Generated with Claude Code