Skip to content

[QST] Compilation issues with make_static_tensor and RealView #759

@deanljohnson

Description

@deanljohnson

I am trying to get a feel for the matx api and usage and am running into compilation issues with static tensors. With the following code:

constexpr int N = 1'000;
auto t_samples = matx::make_static_tensor<cuda::std::complex<float>, N>();
auto real = t_samples.RealView();

I get the following compilation error:

/usr/local/include/matx/core/tensor.h(815): error: too many initializer values
      Desc new_desc{this->desc_.Shape(), std::move(strides)};
                    ^
          detected during instantiation of "auto matx::tensor_t<T, RANK, Storage, Desc>::RealView() const noexcept [with T=cuda::std::__4::complex<float>, RANK=1, Storage=matx::basic_storage<matx::raw_pointer_buffer<cuda::std::__4::complex<float>, matx::matx_allocator<cuda::std::__4::complex<float>>>>, Desc=matx::static_tensor_desc_t<1000000000LL>, U=cuda::std::__4::complex<float>]" at line 154 of /root/src/sw/algo/unit_test/test.cu

If I comment out the call to RealView I get the error:

/usr/local/include/matx/core/tensor_desc.h(374): error: identifier "matx::static_tensor_desc_t<(long long)1000000000ll  > ::shape_" is undefined in device code

Is there a reason I should not expect this to work using static tensors? The same code using make_tensor<cuda::std::complex<float>>({N}); compiles without issue.

NVCC compiler

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Aug_14_10:10:22_PDT_2024
Cuda compilation tools, release 12.6, V12.6.68
Build cuda_12.6.r12.6/compiler.34714021_0

MatX commit: 86b74bc (current master)

Host Compiler: gcc 11.4.1 20231218

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions