Repository navigation
Fixed Bug with assume_aligned not being made for device - #13
Merged
Merged
Conversation
karl-kes
reviewed
Sep 30, 2026
Comment on lines
98
to
104
| template <typename T> [[nodiscard]] XPU_CUDA_CALLABLE | ||
| constexpr auto assume_aligned(T* ptr) noexcept -> T* { | ||
| if constexpr (is_padded<T>) { | ||
| return std::assume_aligned<default_align<T>>(ptr); | ||
| return xstd::assume_aligned<default_align<T>>(ptr); | ||
| } else { | ||
| return ptr; | ||
| } |
Contributor
There was a problem hiding this comment.
This entire block isn't very necessary anymore. Can we just create a wrapper for assume_aligned? The no-op shouldn't be there anyway
karl-kes
reviewed
Sep 30, 2026
karl-kes
left a comment
Contributor
There was a problem hiding this comment.
Good change for the miscompile - just a comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restore the
xpu::assume_aligned<T>(ptr)wrapper. It preserves the type based interface used bybufferandsoa, and applies an alignment assumption only when the type’s storage is padded.Why
Replacing the wrapper with
using xstd::assume_alignedbroke CUDA builds:cuda::std::assume_alignedexpects an alignment value as its first template argument, while existing callers pass a type.Validation
The failure was reproduced with
./scripts/test.sh --cu --clean. Run the same command after applying the fix to confirm the build and tests pass.