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

Correct numerous 20054-D: dynamic initialization errors found on arm+12.2 #14108

Merged

Conversation

robertmaynard
Copy link
Contributor

Description

Compile issues found by compiling libcudf with the rapidsai/devcontainers:23.10-cpp-gcc9-cuda12.2-ubuntu20.04 docker container.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@robertmaynard robertmaynard added bug Something isn't working 3 - Ready for Review Ready for review by team non-breaking Non-breaking change labels Sep 13, 2023
@robertmaynard robertmaynard requested a review from a team as a code owner September 13, 2023 20:29
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label Sep 13, 2023
@bdice
Copy link
Contributor

bdice commented Sep 13, 2023

@robertmaynard Do you think these are "real issues" that we should fix for C++ standards compliance (like avoiding UB) or are they potentially compiler bugs? Do you see these issues with newer GCC versions or older CUDA versions on ARM?

@robertmaynard
Copy link
Contributor Author

@robertmaynard Do you think these are "real issues" that we should fix for C++ standards compliance (like avoiding UB) or are they potentially compiler bugs? Do you see these issues with newer GCC versions or older CUDA versions on ARM?

These are all real issues that aren't exposed by the x86 compiler. I am still digging into why, but here is the background on why these failures are valid:

From the CUDA programming guide 14.5.3.1. Device Memory Space Specifiers:

A __device__, __constant__, __managed__ or __shared__ variable definition cannot have a class type with a non-empty constructor or a non-empty destructor. A constructor for a class type is considered empty at a point in the translation unit, if it is either a trivial constructor or it satisfies all of the following conditions:

  • The constructor function has been defined.
  • The constructor function has no parameters, the initializer list is empty and the function body is an empty compound statement.
  • Its class has no virtual functions, no virtual base classes and no non-static data member initializers.
  • The default constructors of all base classes of its class can be considered empty.
  • For all the nonstatic data members of its class that are of class type (or array thereof), the default constructors can be considered empty.

The simpliest way to understand the above is that the __shared__ type must pass the std::is_trivially_constructible check, if it doesn't it fails to meet the requirements and could generate the warning. As an example if we look at the block_desc_s specification we can see that it fails to meet the is_trivially_constructible requirements ( https://godbolt.org/z/75rv9jd3s )

struct block_desc_s {
  block_desc_s() {};

  explicit constexpr block_desc_s(size_t offset_, uint32_t size_,
                                  uint32_t row_offset_, uint32_t first_row_,
                                  uint32_t num_rows_)
      : offset(offset_), size(size_), row_offset(row_offset_),
        first_row(first_row_), num_rows(num_rows_) {}

  size_t offset;
  uint32_t size;
  uint32_t row_offset;
  uint32_t first_row;
  uint32_t num_rows;
};

@@ -228,7 +228,7 @@ struct PageInfo {
* @brief Struct describing a particular chunk of column data
*/
struct ColumnChunkDesc {
ColumnChunkDesc() = default;
constexpr ColumnChunkDesc() noexcept {};
Copy link
Contributor

@karthikeyann karthikeyann Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does default here not meet 14.5.3.1. Device Memory Space Specifiers specifications?
is default not considered as trivial constructor if all non-static members have trivial constructors?

I see usage of default in this same PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need the constexpr constructor for the byte_stream_s type in page_hdr.cu. I agree that on initial read the = default constructor should be sufficient, but the compiler disagrees.

@robertmaynard
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit a97020f into rapidsai:branch-23.10 Sep 27, 2023
54 checks passed
@robertmaynard robertmaynard deleted the bug/correct_arm_builds branch September 27, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants