From 37ce052386c151fc9d35cff6840ba17421a4cf6e Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Wed, 28 Feb 2024 12:42:07 -0700 Subject: [PATCH] Match Core profiling interface --- profiling/all/impl/Kokkos_Profiling_C_Interface.h | 12 +++--------- profiling/all/impl/Kokkos_Profiling_Interface.hpp | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/profiling/all/impl/Kokkos_Profiling_C_Interface.h b/profiling/all/impl/Kokkos_Profiling_C_Interface.h index 106c52811..2c0e0a9a2 100644 --- a/profiling/all/impl/Kokkos_Profiling_C_Interface.h +++ b/profiling/all/impl/Kokkos_Profiling_C_Interface.h @@ -40,17 +40,11 @@ struct Kokkos_Profiling_SpaceHandle { char name[64]; }; -const static int Kokkos_Profiling_Kernel_Static_Info_Size = 512; - -// uses a union to ensure the struct is as large as the target size +#define KOKKOS_PROFILING_KERNEL_STATIC_INFO_SIZE 512 struct Kokkos_Profiling_Kernel_Static_Info { - union { - struct { - uint64_t functor_size; // sizeof the functor - }; + uint64_t functor_size; // sizeof the functor - char padding[Kokkos_Profiling_Kernel_Static_Info_Size]; - }; + char padding[KOKKOS_PROFILING_KERNEL_STATIC_INFO_SIZE - sizeof(uint64_t)]; }; // NOLINTNEXTLINE(modernize-use-using): C compatibility diff --git a/profiling/all/impl/Kokkos_Profiling_Interface.hpp b/profiling/all/impl/Kokkos_Profiling_Interface.hpp index d9bfd7145..22f8601b1 100644 --- a/profiling/all/impl/Kokkos_Profiling_Interface.hpp +++ b/profiling/all/impl/Kokkos_Profiling_Interface.hpp @@ -124,7 +124,8 @@ namespace Tools { using KernelStaticInfo = Kokkos_Profiling_Kernel_Static_Info; -static_assert(sizeof(KernelStaticInfo) == 512, +static_assert(sizeof(KernelStaticInfo) == + KOKKOS_PROFILING_KERNEL_STATIC_INFO_SIZE, "Internal kokkos developer error. Please report this error, and " "provide information about your compiler and target platform.");