[all-commits] [llvm/llvm-project] eb64c2: [flang][cuda] Restrict managed data transfers to w...

Zhen Wang via All-commits all-commits at lists.llvm.org
Wed Jul 29 09:36:24 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb64c21b7954bdb66ed9ebaefcf400715be321eb
      https://github.com/llvm/llvm-project/commit/eb64c21b7954bdb66ed9ebaefcf400715be321eb
  Author: Zhen Wang <zhenw at nvidia.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M flang/include/flang/Evaluate/tools.h
    M flang/test/Lower/CUDA/cuda-data-transfer.cuf
    M flang/test/Lower/CUDA/cuda-managed-assign.cuf

  Log Message:
  -----------
  [flang][cuda] Restrict managed data transfers to whole-array assignments (#212593)

Assignments involving managed or unified data are lowered to
`cuf.data_transfer`, a synchronous copy. The predicate only excluded
scalar left-hand sides, so array sections were transferred too, turning
a loop that assigns one section per
iteration into a sequence of blocking copies.

Key the decision on the managed operand instead: a transfer when the
managed variable or array is whole, host code when it is a section or an
element. Managed data is host-addressable, so the host assignment is
safe. Managed function results and assignments involving device memory
are unaffected.

This is the behavior specified in the CUDA Fortran Programming Guide
3.4.1:

> An assignment statement where the right hand side is a managed array
section and
> the left hand side is any host or managed variable copies data using
generated
> host code.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list