Conversation
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorSpan.cs
Outdated
Show resolved
Hide resolved
568f93e to
a1a5318
Compare
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
| { | ||
| lengths = new nint[Rank]; | ||
| offsets = new nint[Rank]; | ||
| lengths = stackalloc nint[Rank]; |
There was a problem hiding this comment.
not something to fix in this PR, but dynamically lengthed stackalloc is "bad"
Rather we should be using MaxInlineRank and slicing down to Rank
There was a problem hiding this comment.
Sounds good. Why is dynamically lengthed stackalloc bad?
There was a problem hiding this comment.
Because it results in a lot of additional codegen to handle the fact the length is "unknown". Since we know the maximum is small, its better to do that and slice to avoid the pessimization.
Otherwise, it typically ends up cheaper to just use the array pool; rather than stackalloc at all.
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs
Outdated
Show resolved
Hide resolved
|
/backport to release/9.0 |
|
Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10889237560 |
* empty slice fix * PR comments and more testing * fixing check * fixing array rent init * fixes from PR comments
* empty slice fix * PR comments and more testing * fixing check * fixing array rent init * fixes from PR comments
Fixes #106536. When slicing an empty
Tensor, you should be able to ask for..and get back an empty tensor. This PR enables this behavior.