80 lines · c
1//===-- Shared/Environment.h - OpenMP GPU environments ------------ C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// Environments shared between host and device.10//11//===----------------------------------------------------------------------===//12 13#ifndef OMPTARGET_SHARED_ENVIRONMENT_H14#define OMPTARGET_SHARED_ENVIRONMENT_H15 16#include <stdint.h>17 18struct IdentTy;19 20enum class DeviceDebugKind : uint32_t {21 Assertion = 1U << 0,22 FunctionTracing = 1U << 1,23 CommonIssues = 1U << 2,24 PGODump = 1U << 4,25};26 27struct DeviceEnvironmentTy {28 uint32_t DeviceDebugKind;29 uint32_t NumDevices;30 uint32_t DeviceNum;31 uint32_t DynamicMemSize;32 uint64_t ClockFrequency;33 uintptr_t IndirectCallTable;34 uint64_t IndirectCallTableSize;35 uint64_t HardwareParallelism;36};37 38// NOTE: Please don't change the order of those members as their indices are39// used in the middle end. Always add the new data member at the end.40// Different from KernelEnvironmentTy below, this structure contains members41// that might be modified at runtime.42struct DynamicEnvironmentTy {43 /// Current indentation level for the function trace. Only accessed by thread44 /// 0.45 uint16_t DebugIndentionLevel;46};47 48// NOTE: Please don't change the order of those members as their indices are49// used in the middle end. Always add the new data member at the end.50struct ConfigurationEnvironmentTy {51 uint8_t UseGenericStateMachine = 2;52 uint8_t MayUseNestedParallelism = 2;53 uint8_t ExecMode = 0;54 // Information about (legal) launch configurations.55 //{56 int32_t MinThreads = -1;57 int32_t MaxThreads = -1;58 int32_t MinTeams = -1;59 int32_t MaxTeams = -1;60 int32_t ReductionDataSize = 0;61 int32_t ReductionBufferLength = 0;62 //}63};64 65// NOTE: Please don't change the order of those members as their indices are66// used in the middle end. Always add the new data member at the end.67struct KernelEnvironmentTy {68 ConfigurationEnvironmentTy Configuration;69 IdentTy *Ident = nullptr;70 DynamicEnvironmentTy *DynamicEnv = nullptr;71};72 73struct KernelLaunchEnvironmentTy {74 uint32_t ReductionCnt = 0;75 uint32_t ReductionIterCnt = 0;76 void *ReductionBuffer = nullptr;77};78 79#endif // OMPTARGET_SHARED_ENVIRONMENT_H80