Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QST] Compilation issues with make_static_tensor and RealView #759

Open
deanljohnson opened this issue Oct 4, 2024 · 2 comments
Open

[QST] Compilation issues with make_static_tensor and RealView #759

deanljohnson opened this issue Oct 4, 2024 · 2 comments

Comments

@deanljohnson
Copy link

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

@cliffburdick
Copy link
Collaborator

Hi @deanljohnson , unfortunately static tensors are one of the sources where we've had lots of compatibility issues between different compilers and versions. We will look into this, but I would recommend not using static tensors yet until you get the functionality working. Static tensors exist for saving instructions to compute offsets, which can be very helpful for tensors with many dimensions. For roughly 3 dimensions and below it won't make much of a difference.

@deanljohnson
Copy link
Author

Thanks for the quick response @cliffburdick.

I'll avoid them for now. I don't imagine they will make too large of a difference for what I am doing anyways. This was just me trying to get a feel for matx in general.

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

No branches or pull requests

2 participants