CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
128 lines
5.6 KiB
C++
128 lines
5.6 KiB
C++
//===------ OmptCommonDefs.h - Common definitions for OMPT --*- C++ -*-----===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Common defines and typedefs for OMPT callback and tracing functionality.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef OFFLOAD_INCLUDE_OMPTCOMMONDEFS_H
|
|
#define OFFLOAD_INCLUDE_OMPTCOMMONDEFS_H
|
|
|
|
#ifdef OMPT_SUPPORT
|
|
|
|
#include "omp-tools.h"
|
|
|
|
#pragma push_macro("DEBUG_PREFIX")
|
|
#undef DEBUG_PREFIX
|
|
#define DEBUG_PREFIX "OMPT"
|
|
|
|
#define FUNCPTR_TO_PTR(x) ((void *)(uint64_t)x)
|
|
|
|
#define FOREACH_OMPT_TARGET_CALLBACK(macro) \
|
|
FOREACH_OMPT_DEVICE_EVENT(macro) \
|
|
FOREACH_OMPT_NOEMI_EVENT(macro) \
|
|
FOREACH_OMPT_EMI_EVENT(macro)
|
|
|
|
// Common device tracing functions
|
|
#define FOREACH_OMPT_DEVICE_TRACING_FN_COMMON(macro) \
|
|
macro(ompt_set_trace_ompt) macro(ompt_start_trace) macro(ompt_flush_trace) \
|
|
macro(ompt_stop_trace) macro(ompt_advance_buffer_cursor) \
|
|
macro(ompt_get_record_type)
|
|
|
|
// Supported device tracing entry points
|
|
#define FOREACH_OMPT_DEVICE_TRACING_FN(macro) \
|
|
FOREACH_OMPT_DEVICE_TRACING_FN_COMMON(macro) \
|
|
macro(ompt_get_record_ompt) macro(ompt_get_device_time) \
|
|
macro(ompt_translate_time)
|
|
|
|
// Device tracing functionalities, which are also e.g. coupled to mutexes
|
|
#define FOREACH_OMPT_DEVICE_TRACING_FN_IMPLEMENTAIONS(macro) \
|
|
FOREACH_OMPT_DEVICE_TRACING_FN_COMMON(macro) \
|
|
macro(ompt_set_timestamp) macro(ompt_set_granted_teams)
|
|
|
|
#define OMPT_API_ROUTINE static
|
|
|
|
#define OMPT_CALLBACK_AVAILABLE(fn) (llvm::omp::target::ompt::Initialized && fn)
|
|
|
|
#define OMPT_IF_BUILT(stmt) stmt
|
|
|
|
#define OMPT_IF_ENABLED(stmts) \
|
|
do { \
|
|
if (llvm::omp::target::ompt::Initialized) { \
|
|
stmts \
|
|
} \
|
|
} while (0)
|
|
|
|
#define OMPT_IF_TRACING_ENABLED(stmts) \
|
|
do { \
|
|
if (llvm::omp::target::ompt::TracingActive) { \
|
|
stmts \
|
|
} \
|
|
} while (0)
|
|
|
|
#define OMPT_FRAME_FLAGS (ompt_frame_runtime | OMPT_FRAME_POSITION_DEFAULT)
|
|
|
|
#if (__PPC64__ | __arm__)
|
|
#define OMPT_GET_FRAME_ADDRESS(level) __builtin_frame_address(level)
|
|
#define OMPT_FRAME_POSITION_DEFAULT ompt_frame_cfa
|
|
#else
|
|
#define OMPT_GET_FRAME_ADDRESS(level) __builtin_frame_address(level)
|
|
#define OMPT_FRAME_POSITION_DEFAULT ompt_frame_framepointer
|
|
#endif
|
|
|
|
#define OMPT_PTR_UNKNOWN ((void *)0)
|
|
|
|
#define performIfOmptInitialized(stmt) \
|
|
do { \
|
|
if (llvm::omp::target::ompt::Initialized) { \
|
|
stmt; \
|
|
} \
|
|
} while (0)
|
|
|
|
#define performOmptCallback(CallbackName, ...) \
|
|
do { \
|
|
if (ompt_callback_##CallbackName##_fn) \
|
|
ompt_callback_##CallbackName##_fn(__VA_ARGS__); \
|
|
} while (0)
|
|
|
|
typedef ompt_set_result_t (*libomptarget_ompt_set_trace_ompt_t)(
|
|
int Device, unsigned int Enable, unsigned int EventTy);
|
|
typedef int (*libomptarget_ompt_start_trace_t)(int,
|
|
ompt_callback_buffer_request_t,
|
|
ompt_callback_buffer_complete_t);
|
|
typedef int (*libomptarget_ompt_flush_trace_t)(int);
|
|
typedef int (*libomptarget_ompt_stop_trace_t)(int);
|
|
typedef int (*libomptarget_ompt_advance_buffer_cursor_t)(
|
|
ompt_device_t *, ompt_buffer_t *, size_t, ompt_buffer_cursor_t,
|
|
ompt_buffer_cursor_t *);
|
|
typedef ompt_get_record_ompt_t libomptarget_ompt_get_record_ompt_t;
|
|
typedef ompt_device_time_t (*libomptarget_ompt_get_device_time_t)(
|
|
ompt_device_t *);
|
|
typedef ompt_translate_time_t libomptarget_ompt_translate_time_t;
|
|
typedef ompt_device_time_t (*libomptarget_ompt_get_device_time_t)(
|
|
ompt_device_t *);
|
|
typedef ompt_record_t (*libomptarget_ompt_get_record_type_t)(
|
|
ompt_buffer_t *, ompt_buffer_cursor_t);
|
|
typedef void (*libomptarget_ompt_set_timestamp_t)(uint64_t start, uint64_t end);
|
|
typedef void (*libomptarget_ompt_set_granted_teams_t)(uint32_t);
|
|
|
|
/// Function type def used for maintaining unique target region, target
|
|
/// operations ids
|
|
typedef uint64_t (*IdInterfaceTy)();
|
|
|
|
#pragma pop_macro("DEBUG_PREFIX")
|
|
|
|
#else
|
|
#define performIfOmptInitialized(stmt)
|
|
#define OMPT_IF_BUILT(stmt)
|
|
#define OMPT_IF_ENABLED(stmts)
|
|
#define OMPT_IF_TRACING_ENABLED(stmts)
|
|
#endif // OMPT_SUPPORT
|
|
|
|
#endif // OFFLOAD_INCLUDE_OMPTCOMMONDEFS_H
|