Skip to content

Fix static tensors#1147

Merged
cliffburdick merged 2 commits intomainfrom
static_tensors
Apr 9, 2026
Merged

Fix static tensors#1147
cliffburdick merged 2 commits intomainfrom
static_tensors

Conversation

@cliffburdick
Copy link
Copy Markdown
Collaborator

Closes #125

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Apr 8, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cliffburdick
Copy link
Copy Markdown
Collaborator Author

/build

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR fixes two categories of bugs with static tensors (static_tensor_desc_t): missing __MATX_HOST__ __MATX_DEVICE__ attributes on four static methods (Strides, Rank, Shape, TotalSize) that prevented device-side use, and a compile error in RealView()/ImagView() that tried to runtime-construct a purely compile-time static descriptor with modified strides. The fix in tensor.h introduces an OutDesc alias that falls back to an equivalent dynamic descriptor (tensor_desc_cr_ds_t) when the source is a static descriptor. A comprehensive new test suite (TensorCreationTestsComplex) and multiple arithmetic/view tests cover the fixed paths.

Confidence Score: 5/5

Safe to merge — targeted bug fixes with no regressions and good test coverage.

All changes are correctness fixes for previously broken functionality (device-side attribute annotations, runtime descriptor construction). The fallback-to-dynamic-descriptor strategy in RealView/ImagView is sound and consistent. No P0 or P1 issues found. New tests exercise the fixed code paths across all complex types and executors.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
include/matx/core/tensor_desc.h Adds __MATX_INLINE__ __MATX_HOST__ __MATX_DEVICE__ to four previously host-only static constexpr methods in static_tensor_desc_t, enabling device-side access.
include/matx/core/tensor.h Introduces OutDesc type alias in RealView() and ImagView() that substitutes a runtime-constructible dynamic descriptor when the source tensor uses a static descriptor, fixing a compile error.
test/00_tensor/TensorCreationTests.cu Adds TYPED_TEST_SUITE registration for TensorCreationTestsComplex, fixes MakeStaticShape to extract the scalar type from the tuple parameter, and adds ~300 lines of new static-tensor tests covering arithmetic (1–4D), shape/descriptor queries, and real/imag views.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["RealView() / ImagView() called on tensor_t<T, RANK, Desc>"] --> B{is_matx_static_descriptor<Desc>?}
    B -- Yes --> C["OutDesc = tensor_desc_cr_ds_t<shape_type, stride_type, RANK>\n(dynamic descriptor)"]
    B -- No --> D["OutDesc = Desc\n(original descriptor)"]
    C --> E["OutDesc new_desc{shape, modified_strides}"]
    D --> E
    E --> F["tensor_t<InnerType, RANK, OutDesc> view"]
    F --> G["Non-owning storage pointing to real or imag offset"]
Loading

Reviews (2): Last reviewed commit: "Conditional switch on static tensor for ..." | Re-trigger Greptile

@cliffburdick
Copy link
Copy Markdown
Collaborator Author

/build

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 9, 2026

Coverage Status

Coverage is 91.74%static_tensors into main. No base build found for main.

@cliffburdick cliffburdick merged commit 34244ef into main Apr 9, 2026
1 check passed
@cliffburdick cliffburdick deleted the static_tensors branch April 9, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Investigate static_tensor issues

2 participants