4 Commits

Author SHA1 Message Date
Joseph Huber
154a128c65 Reapply "[OpenMP] Move OpenMP implicit argument to the end and reformat" (#186309)
Should be working downstream now
This reverts commit 9b61ff210fdff752d5db55b128474e9990258488.
2026-03-13 15:48:37 -05:00
theRonShark
9b61ff210f
Revert "[OpenMP] Move OpenMP implicit argument to the end and reformat" (#186309)
Reverts llvm/llvm-project#185989
2026-03-13 05:20:40 +00:00
Joseph Huber
4376fbd793
[OpenMP] Move OpenMP implicit argument to the end and reformat (#185989)
Summary:
We use this `dyn_ptr` argument in Clang/OpenMP to handle the
`KernelLaunchEnvironment`. This is a per-kernel argument used to share
some information. Currenetly, it's prepended to the argument list and we
generate storage for it in the runtime.

This is bad for a few reasons:
1. It changes the ABI by shifting user arguments
2. It cannot be trivially be left uninitialized if unused
3. The runtime must allocate its own memory for it

This PR changes it to be appended instead. Additionally, space for this
is always emitted. This means the OMPIRBuilder itself will provide the
storage, we simply need to populate it in the runtime if it is used.
This means that if it's unused we don't always pay the cost and it's
easier for non-OpenMP users to ignore it.

Backward compatibility is maintained by auto-upgrading the kernel
arguments. In `libomptarget` we completely allocate a new buffer to
store this in the new format. The plugins still need to respect the old
ABI of the called device object, so we simply rotate it if it's the old
version.
2026-03-12 18:08:22 -05:00
David Pagan
480ad3d868
[clang][OpenMP] 6.0: Add defaultmap implicit-behavior 'private' (#158712)
Per OpenMP 6.0 specification, section 7.9.9

Argument keywords, page 291, L17
Semantics, page 292, L15-16
The behavior of 'private' should be described in the same manner as that
  of 'firstprivate'

  15 ... If implicit-behavior is firstprivate, 16 the attribute is a
  data-sharing attribute of firstprivate.

  Relevant OpenMP 6.0 issues
defaultmap clause new implicit-behavior 'private' should be documented
      https://github.com/OpenMP/spec/issues/4571
    Issue 4571: Add missing sentence about private to defaultmap
      https://github.com/OpenMP/spec/pull/4577

Testing:
  Updated 'defaultmap' error message and codegen LIT tests to verify
  behavior of 'private' in OpenMP 6.0.
2025-09-16 12:29:31 -07:00