Skip to content

[flang][cuda] Update condition in descriptor data transfer #148306

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

Merged
merged 1 commit into from
Jul 11, 2025

Conversation

clementval
Copy link
Contributor

When the two descriptor have the same number of elements and are contiguous, the transfer can be done via pointers.

@clementval clementval requested a review from wangzpgi July 11, 2025 22:07
// Special case when rhs is bigger than lhs and both are contiguous arrays.
// In this case we do a simple ptr to ptr transfer with the size of lhs.
// This is be allowed in the reference compiler and it avoids error
// triggered in the Assign runtime function used for the main case below.
if (!srcDesc->IsContiguous() || !dstDesc->IsContiguous())
terminator.Crash("Unsupported data transfer: mismatching element counts "
"with non-contiguous arrays");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is my understanding correct that both new and old version achieve the same goal of only allowing contiguous arrays for the data transfer, but the old version gives an error message about unsupported data transfer?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! I see there is a difference between <= and <. Didn't notice it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah and the new version fall back on the runtime assign function instead of giving an error.

@clementval clementval merged commit f642b63 into llvm:main Jul 11, 2025
10 checks passed
@clementval clementval deleted the cuf_mem_ptr branch July 11, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants