Remove user defined constructor from AllocatorHandleImpl#301
Merged
chillenzer merged 1 commit intoalpaka-group:devfrom Mar 20, 2026
Merged
Remove user defined constructor from AllocatorHandleImpl#301chillenzer merged 1 commit intoalpaka-group:devfrom
chillenzer merged 1 commit intoalpaka-group:devfrom
Conversation
chillenzer
approved these changes
Mar 20, 2026
Contributor
chillenzer
left a comment
There was a problem hiding this comment.
Why would that even be in there? Thanks for the fix but it looks like you had a lot of fun!
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.
So this was a fun one. Really ended up getting to the point of a
printfbefore and after every function call and being totally puzzled why execution just stops in the middle silently.I had this piece of code,
It was called by one thread in a block as below
This pointer was then stored in shared memory. And then later all threads used this pointer to access the allocated memory. What i saw was that I get segfaults.
Eventually with the
printfs I noted that the main thread doing the allocation printsabut notb.So my main thread execution was failing silently.
Switching
allocateMemoryandallocateRawMemoryto accept the heap handle by reference solved the issue.I guess what happens is the (implicitly defined) copy constructor of the heap handle is not marked as device. And this was crashing my main thread execution silently.
Removing the host only constructor fixes my issue and lets me pass by value.
Marking the constructor as constexpr also has the same effect. I guess because then the compiler generated copy constructor is also constexpr.
I decided just removing the user defined constructor is cleanest, but if you prefer you can opt for marking it as constexpr/host device as well.