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

[BUG]: cuda::std::extents::static_extent truncates cuda::std::dynamic_extent when index_type is unsigned int #1236

Open
1 task done
pciolkosz opened this issue Dec 21, 2023 · 0 comments
Labels
bug Something isn't working right.

Comments

@pciolkosz
Copy link
Contributor

Is this a duplicate?

Type of Bug

Compile-time Error

Component

libcu++

Describe the bug

It seems that when index_type in cuda::std::extents is unsigned int then dynamic extents are truncated to a smaller type. It works correctly if index_type is int, not sure about other types.

How to Reproduce

#include <cuda/std/type_traits>
#include <cuda/std/mdspan>

int main()
{
    cuda::std::extents<unsigned int, cuda::std::dynamic_extent> e_unsigned(1); 
    cuda::std::extents<int, cuda::std::dynamic_extent> e_signed(1); 

    static_assert(cuda::std::is_same_v<decltype(e_unsigned.static_extent(0)), decltype(e_signed.static_extent(0))>);
    static_assert(e_unsigned.static_extent(0) == e_signed.static_extent(0));
    static_assert(e_unsigned.static_extent(0) == cuda::std::dynamic_extent);
    static_assert(e_signed.static_extent(0) == cuda::std::dynamic_extent);

}

Expected behavior

cuda::std::extents::static_extent should return cuda::std::dynamic_extent for dynamic extents regardless of what index_type is

Reproduction link

https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIAruiakl9ZATwDKjdAGFUtEywYgATKUcAZPAZMADl3ACNMYglpAAdUBUI7Bhc3D29SOITbAQCg0JYIqKlLTGtshiECJmICFPdPLhKypMrqglyQ8Mi9BSqaurTG3raO/MKJAEpLVBNiZHYOAFIvAGZA5DcsAGpFladTcwB6XvRDggBPGMwAfQJiJkIFXexFjQBBZbWGDbNMHb2DkxjgRTix0AoYoZnq8Pu9AgQtiwHgwIBMYYsAOwAIRhWzxW0B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MDy1gYYCpgqvyZr2tsJw2O4/jXiE8TYVdwjHD2/gRBO3ofVuz10h9V7g2%2Bz0pQ2548b7bdx37YD4yXQ95QH6fWRJMfF2/R9bQX3fAj/ZDeQvT0n2PxDN9FFMdyYJgdaAlAIgXrujTgQ5MBTz%2BPVJqkR44jyTsTUm5N56Z0aFsNOCl4FYWzi3fCjMJBEz5lIDQXhgJswYhoFiGINArCRqLMOPEZ5N0EvghmwsvBgPDiw9hUwVoJHsJIIAA%3D%3D

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

@pciolkosz pciolkosz added the bug Something isn't working right. label Dec 21, 2023
@github-project-automation github-project-automation bot moved this to Todo in CCCL Dec 21, 2023
@pciolkosz pciolkosz changed the title [BUG]: cudastd::extents::static_extent truncates cudastd::dynamic_extent when index_type is unsigned int [BUG]: cuda::std::extents::static_extent truncates cuda::std::dynamic_extent when index_type is unsigned int Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Status: Todo
Development

No branches or pull requests

1 participant