Skip to content
Snippets Groups Projects

[Simd] Ignore value-initialization issues in vectorclass.

Merged Jö Fahlke requested to merge simd-ignore-vectorclass-value-initialization-issues into master

Value-initialized Vectorclass simd types are not always initialized. The reason is that vectorclass defines default-constructors for its Simd types with empty body and no member initializers. Value-initialization will see those constructors and invoke default-initialization. As the mask types sometimes just contain an unsigned short or similar fundamental data type, default-initializing that does nothing and leaves it inintialized.

To make value-initialization work reliably, vectorclass would need to do one of two things:

  • Make sure the default-constructor is implicitly or explicitly defaulted. That would mean value-initialization would invoke zero-initialization before default-inizialization, which would clear the member
  • Provide a default initializer when declaring the member, which would then be used when the class does not define an initializer for the member in the default-constructor's member-initializer-list.

Since I can't really fix vectorclass, work around this issue by using direct-initialization with an initializer (Simd::Scalar<V>(0)) to initialize simd types.

Closes: extensions/dune-vectorclass#9 (closed)

Edited by Jö Fahlke

Merge request reports

Pipeline #18280 passed

Pipeline passed for d676c3cb on simd-ignore-vectorclass-value-initialization-issues

Approval is optional

Merged by Jö FahlkeJö Fahlke 5 years ago (May 6, 2019 12:59pm UTC)

Merge details

Pipeline #18284 passed

Pipeline passed for 80aa79bb on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading