Skip to content

Conversation

@adurang
Copy link
Contributor

@adurang adurang commented Oct 22, 2025

Follow-up from #162652

@llvmbot
Copy link
Member

llvmbot commented Oct 22, 2025

@llvm/pr-subscribers-offload

Author: Alex Duran (adurang)

Changes

Continuation from #162652


Full diff: https://github.com/llvm/llvm-project/pull/164613.diff

4 Files Affected:

  • (modified) offload/include/OffloadPolicy.h (-1)
  • (modified) offload/include/OpenMP/InternalTypes.h (+24-6)
  • (modified) offload/libomptarget/OpenMP/API.cpp (-23)
  • (modified) offload/libomptarget/OpenMP/InteropAPI.cpp (-8)
diff --git a/offload/include/OffloadPolicy.h b/offload/include/OffloadPolicy.h index 800fefb224326..6656e2dd9b595 100644 --- a/offload/include/OffloadPolicy.h +++ b/offload/include/OffloadPolicy.h @@ -22,7 +22,6 @@ enum kmp_target_offload_kind_t { tgt_mandatory = 2 }; -extern "C" int __kmpc_get_target_offload(void) __attribute__((weak)); class OffloadPolicy { diff --git a/offload/include/OpenMP/InternalTypes.h b/offload/include/OpenMP/InternalTypes.h index bd84c38fb2011..ce339f3f5358b 100644 --- a/offload/include/OpenMP/InternalTypes.h +++ b/offload/include/OpenMP/InternalTypes.h @@ -70,10 +70,28 @@ typedef struct kmp_task { int32_t part_id; } kmp_task_t; -int32_t __kmpc_global_thread_num(void *) __attribute__((weak)); -bool __kmpc_omp_has_task_team(int32_t gtid) __attribute__((weak)); -void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid) - __attribute__((weak)); +// Implemented in libomp, they are called from within __tgt_* functions. +int32_t __kmpc_global_thread_num(void *); +bool __kmpc_omp_has_task_team(int32_t gtid); +void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid); +int __kmpc_get_target_offload(void); +int __kmpc_get_target_offload(void); +kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags, + size_t sizeof_kmp_task_t, + size_t sizeof_shareds, + kmp_routine_entry_t task_entry); +kmp_task_t * +__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags, + size_t sizeof_kmp_task_t, size_t sizeof_shareds, + kmp_routine_entry_t task_entry, int64_t device_id); +int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid, + kmp_task_t *new_task, int32_t ndeps, + kmp_depend_info_t *dep_list, + int32_t ndeps_noalias, + kmp_depend_info_t *noalias_dep_list); +void __kmpc_omp_wait_deps(ident_t *loc_ref, int32_t gtid, int32_t ndeps, + kmp_depend_info_t *dep_list, int32_t ndeps_noalias, + kmp_depend_info_t *noalias_dep_list); /** * The argument set that is passed from asynchronous memory copy to block @@ -120,7 +138,7 @@ struct TargetMemcpyArgsTy { : Dst(Dst), Src(Src), DstDevice(DstDevice), SrcDevice(SrcDevice), IsRectMemcpy(false), Length(Length), DstOffset(DstOffset), SrcOffset(SrcOffset), ElementSize(0), NumDims(0), Volume(0), - DstOffsets(0), SrcOffsets(0), DstDimensions(0), SrcDimensions(0){}; + DstOffsets(0), SrcOffsets(0), DstDimensions(0), SrcDimensions(0) {}; /** * Constructor for rectangle dimensional copy @@ -134,7 +152,7 @@ struct TargetMemcpyArgsTy { IsRectMemcpy(true), Length(0), DstOffset(0), SrcOffset(0), ElementSize(ElementSize), NumDims(NumDims), Volume(Volume), DstOffsets(DstOffsets), SrcOffsets(SrcOffsets), - DstDimensions(DstDimensions), SrcDimensions(SrcDimensions){}; + DstDimensions(DstDimensions), SrcDimensions(SrcDimensions) {}; }; struct TargetMemsetArgsTy { diff --git a/offload/libomptarget/OpenMP/API.cpp b/offload/libomptarget/OpenMP/API.cpp index b0f0573833713..941d2a7d74c50 100644 --- a/offload/libomptarget/OpenMP/API.cpp +++ b/offload/libomptarget/OpenMP/API.cpp @@ -48,29 +48,6 @@ void *targetLockExplicit(void *HostPtr, size_t Size, int DeviceNum, const char *Name); void targetUnlockExplicit(void *HostPtr, int DeviceNum, const char *Name); -// Implemented in libomp, they are called from within __tgt_* functions. -extern "C" { -int __kmpc_get_target_offload(void) __attribute__((weak)); -kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags, - size_t sizeof_kmp_task_t, - size_t sizeof_shareds, - kmp_routine_entry_t task_entry) - __attribute__((weak)); - -kmp_task_t * -__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags, - size_t sizeof_kmp_task_t, size_t sizeof_shareds, - kmp_routine_entry_t task_entry, int64_t device_id) - __attribute__((weak)); - -int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid, - kmp_task_t *new_task, int32_t ndeps, - kmp_depend_info_t *dep_list, - int32_t ndeps_noalias, - kmp_depend_info_t *noalias_dep_list) - __attribute__((weak)); -} - EXTERN int omp_get_num_devices(void) { TIMESCOPE(); OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0))); diff --git a/offload/libomptarget/OpenMP/InteropAPI.cpp b/offload/libomptarget/OpenMP/InteropAPI.cpp index d6ef17c06355c..b307011445170 100644 --- a/offload/libomptarget/OpenMP/InteropAPI.cpp +++ b/offload/libomptarget/OpenMP/InteropAPI.cpp @@ -18,14 +18,6 @@ #include <cstdlib> #include <cstring> -extern "C" { - -void __kmpc_omp_wait_deps(ident_t *loc_ref, int32_t gtid, int32_t ndeps, - kmp_depend_info_t *dep_list, int32_t ndeps_noalias, - kmp_depend_info_t *noalias_dep_list); - -} // extern "C" - namespace { omp_interop_rc_t getPropertyErrorType(omp_interop_property_t Property) { switch (Property) { 
@adurang adurang requested a review from jhuber6 October 22, 2025 12:30
@github-actions
Copy link

github-actions bot commented Oct 22, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@mjklemm mjklemm left a comment

Choose a reason for hiding this comment

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

Please remove the unrelated formatting changes.

adurang and others added 2 commits October 23, 2025 22:24
Co-authored-by: Michael Klemm <michael.klemm@amd.com>
Co-authored-by: Michael Klemm <michael.klemm@amd.com>
@adurang
Copy link
Contributor Author

adurang commented Oct 23, 2025

Please remove the unrelated formatting changes.

formatting tools hiccup :) thanks!

Copy link
Contributor

@kevinsala kevinsala left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@adurang adurang requested a review from mjklemm October 24, 2025 08:23
Copy link
Contributor

@mjklemm mjklemm left a comment

Choose a reason for hiding this comment

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

LGTM

@adurang adurang merged commit 426d1fe into llvm:main Oct 24, 2025
10 checks passed
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
…er (llvm#164613) Follow-up from llvm#162652 --------- Co-authored-by: Michael Klemm <michael.klemm@amd.com>
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…er (llvm#164613) Follow-up from llvm#162652 --------- Co-authored-by: Michael Klemm <michael.klemm@amd.com>
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…er (llvm#164613) Follow-up from llvm#162652 --------- Co-authored-by: Michael Klemm <michael.klemm@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 participants