1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/include/llvm/Frontend/OpenMP/OMP.td

1705 lines
53 KiB
TableGen
Raw Permalink Normal View History

//===-- OMP.td - OpenMP directive definition file ----------*- tablegen -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This is the definition file for OpenMP directives and clauses.
//
//===----------------------------------------------------------------------===//
include "llvm/Frontend/Directive/DirectiveBase.td"
//===----------------------------------------------------------------------===//
// Definition of general OpenMP information
//===----------------------------------------------------------------------===//
def OpenMP : DirectiveLanguage {
let name = "OpenMP";
let cppNamespace = "omp"; // final namespace will be llvm::omp
let directivePrefix = "OMPD_";
let clausePrefix = "OMPC_";
let makeEnumAvailableInNamespace = true;
let enableBitmaskEnumInNamespace = true;
let clauseEnumSetClass = "OmpClauseSet";
let flangClauseBaseClass = "OmpClause";
}
//===----------------------------------------------------------------------===//
// Definition of OpenMP clauses
//===----------------------------------------------------------------------===//
def OMPC_Allocator : Clause<"allocator"> {
let clangClass = "OMPAllocatorClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_If : Clause<"if"> {
let clangClass = "OMPIfClause";
let flangClass = "OmpIfClause";
}
def OMPC_Final : Clause<"final"> {
let clangClass = "OMPFinalClause";
let flangClass = "ScalarLogicalExpr";
}
def OMPC_NumThreads : Clause<"num_threads"> {
let clangClass = "OMPNumThreadsClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_SafeLen : Clause<"safelen"> {
let clangClass = "OMPSafelenClause";
let flangClass = "ScalarIntConstantExpr";
}
def OMPC_SimdLen : Clause<"simdlen"> {
let clangClass = "OMPSimdlenClause";
let flangClass = "ScalarIntConstantExpr";
}
def OMPC_Collapse : Clause<"collapse"> {
let clangClass = "OMPCollapseClause";
let flangClass = "ScalarIntConstantExpr";
}
def OMPC_Default : Clause<"default"> {
let clangClass = "OMPDefaultClause";
let flangClass = "OmpDefaultClause";
}
def OMPC_Private : Clause<"private"> {
let clangClass = "OMPPrivateClause";
let flangClass = "OmpObjectList";
}
[OpenMP] Implement '#pragma omp tile', by Michael Kruse (@Meinersbur). The tile directive is in OpenMP's Technical Report 8 and foreseeably will be part of the upcoming OpenMP 5.1 standard. This implementation is based on an AST transformation providing a de-sugared loop nest. This makes it simple to forward the de-sugared transformation to loop associated directives taking the tiled loops. In contrast to other loop associated directives, the OMPTileDirective does not use CapturedStmts. Letting loop associated directives consume loops from different capture context would be difficult. A significant amount of code generation logic is taking place in the Sema class. Eventually, I would prefer if these would move into the CodeGen component such that we could make use of the OpenMPIRBuilder, together with flang. Only expressions converting between the language's iteration variable and the logical iteration space need to take place in the semantic analyzer: Getting the of iterations (e.g. the overload resolution of `std::distance`) and converting the logical iteration number to the iteration variable (e.g. overload resolution of `iteration + .omp.iv`). In clang, only CXXForRangeStmt is also represented by its de-sugared components. However, OpenMP loop are not defined as syntatic sugar. Starting with an AST-based approach allows us to gradually move generated AST statements into CodeGen, instead all at once. I would also like to refactor `checkOpenMPLoop` into its functionalities in a follow-up. In this patch it is used twice. Once for checking proper nesting and emitting diagnostics, and additionally for deriving the logical iteration space per-loop (instead of for the loop nest). Differential Revision: https://reviews.llvm.org/D76342
2021-02-12 20:26:59 +01:00
def OMPC_Sizes: Clause<"sizes"> { let clangClass = "OMPSizesClause"; }
def OMPC_Full: Clause<"full"> { let clangClass = "OMPFullClause"; }
def OMPC_Partial: Clause<"partial"> { let clangClass = "OMPPartialClause"; }
def OMPC_FirstPrivate : Clause<"firstprivate"> {
let clangClass = "OMPFirstprivateClause";
let flangClass = "OmpObjectList";
}
def OMPC_LastPrivate : Clause<"lastprivate"> {
let clangClass = "OMPLastprivateClause";
let flangClass = "OmpObjectList";
}
def OMPC_Shared : Clause<"shared"> {
let clangClass = "OMPSharedClause";
let flangClass = "OmpObjectList";
}
def OMPC_Reduction : Clause<"reduction"> {
let clangClass = "OMPReductionClause";
let flangClass = "OmpReductionClause";
}
def OMPC_Linear : Clause<"linear"> {
let clangClass = "OMPLinearClause";
let flangClass = "OmpLinearClause";
}
def OMPC_Aligned : Clause<"aligned"> {
let clangClass = "OMPAlignedClause";
let flangClass = "OmpAlignedClause";
}
def OMPC_Copyin : Clause<"copyin"> {
let clangClass = "OMPCopyinClause";
let flangClass = "OmpObjectList";
}
def OMPC_CopyPrivate : Clause<"copyprivate"> {
let clangClass = "OMPCopyprivateClause";
let flangClass = "OmpObjectList";
}
def OMP_PROC_BIND_master : ClauseVal<"master",2,1> {}
def OMP_PROC_BIND_close : ClauseVal<"close",3,1> {}
def OMP_PROC_BIND_spread : ClauseVal<"spread",4,1> {}
def OMP_PROC_BIND_primary : ClauseVal<"primary",5,1> {}
def OMP_PROC_BIND_default : ClauseVal<"default",6,0> {}
def OMP_PROC_BIND_unknown : ClauseVal<"unknown",7,0> { let isDefault = true; }
def OMPC_ProcBind : Clause<"proc_bind"> {
let clangClass = "OMPProcBindClause";
let flangClass = "OmpProcBindClause";
let enumClauseValue = "ProcBindKind";
let allowedClauseValues = [
OMP_PROC_BIND_primary,
OMP_PROC_BIND_master,
OMP_PROC_BIND_close,
OMP_PROC_BIND_spread,
OMP_PROC_BIND_default,
OMP_PROC_BIND_unknown
];
}
// static and auto are C++ keywords so need a capital to disambiguate.
def OMP_SCHEDULE_Static : ClauseVal<"Static", 2, 1> {}
def OMP_SCHEDULE_Dynamic : ClauseVal<"Dynamic", 3, 1> {}
def OMP_SCHEDULE_Guided : ClauseVal<"Guided", 4, 1> {}
def OMP_SCHEDULE_Auto : ClauseVal<"Auto", 5, 1> {}
def OMP_SCHEDULE_Runtime : ClauseVal<"Runtime", 6, 1> {}
def OMP_SCHEDULE_Default : ClauseVal<"Default", 7, 0> { let isDefault = 1; }
def OMPC_Schedule : Clause<"schedule"> {
let clangClass = "OMPScheduleClause";
let flangClass = "OmpScheduleClause";
let enumClauseValue = "ScheduleKind";
let allowedClauseValues = [
OMP_SCHEDULE_Static,
OMP_SCHEDULE_Dynamic,
OMP_SCHEDULE_Guided,
OMP_SCHEDULE_Auto,
OMP_SCHEDULE_Runtime,
OMP_SCHEDULE_Default
];
}
def OMPC_Ordered : Clause<"ordered"> {
let clangClass = "OMPOrderedClause";
let flangClass = "ScalarIntConstantExpr";
let isValueOptional = true;
}
def OMPC_NoWait : Clause<"nowait"> {
let clangClass = "OMPNowaitClause";
}
def OMPC_Untied : Clause<"untied"> { let clangClass = "OMPUntiedClause"; }
def OMPC_Mergeable : Clause<"mergeable"> {
let clangClass = "OMPMergeableClause";
}
def OMPC_Read : Clause<"read"> { let clangClass = "OMPReadClause"; }
def OMPC_Write : Clause<"write"> { let clangClass = "OMPWriteClause"; }
def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
def OMPC_Release : Clause<"release"> { let clangClass = "OMPReleaseClause"; }
def OMPC_Relaxed : Clause<"relaxed"> { let clangClass = "OMPRelaxedClause"; }
def OMPC_Depend : Clause<"depend"> {
let clangClass = "OMPDependClause";
let flangClass = "OmpDependClause";
}
def OMPC_Device : Clause<"device"> {
let clangClass = "OMPDeviceClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_Threads : Clause<"threads"> { let clangClass = "OMPThreadsClause"; }
def OMPC_Simd : Clause<"simd"> { let clangClass = "OMPSIMDClause"; }
def OMPC_Map : Clause<"map"> {
let clangClass = "OMPMapClause";
let flangClass = "OmpMapClause";
}
def OMPC_NumTeams : Clause<"num_teams"> {
let clangClass = "OMPNumTeamsClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_ThreadLimit : Clause<"thread_limit"> {
let clangClass = "OMPThreadLimitClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_Priority : Clause<"priority"> {
let clangClass = "OMPPriorityClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_GrainSize : Clause<"grainsize"> {
let clangClass = "OMPGrainsizeClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_NoGroup : Clause<"nogroup"> {
let clangClass = "OMPNogroupClause";
}
def OMPC_NumTasks : Clause<"num_tasks"> {
let clangClass = "OMPNumTasksClause";
let flangClass = "ScalarIntExpr";
}
def OMPC_Hint : Clause<"hint"> {
let clangClass = "OMPHintClause";
let flangClass = "ConstantExpr";
}
def OMPC_DistSchedule : Clause<"dist_schedule"> {
let clangClass = "OMPDistScheduleClause";
let flangClass = "ScalarIntExpr";
let isValueOptional = true;
}
def OMPC_DefaultMap : Clause<"defaultmap"> {
let clangClass = "OMPDefaultmapClause";
let flangClass = "OmpDefaultmapClause";
}
def OMPC_To : Clause<"to"> {
let clangClass = "OMPToClause";
let flangClass = "OmpObjectList";
}
def OMPC_From : Clause<"from"> {
let clangClass = "OMPFromClause";
let flangClass = "OmpObjectList";
}
def OMPC_UseDevicePtr : Clause<"use_device_ptr"> {
let clangClass = "OMPUseDevicePtrClause";
let flangClass = "Name";
let isValueList = true;
}
def OMPC_IsDevicePtr : Clause<"is_device_ptr"> {
let clangClass = "OMPIsDevicePtrClause";
let flangClass = "Name";
let isValueList = true;
}
def OMPC_TaskReduction : Clause<"task_reduction"> {
let clangClass = "OMPTaskReductionClause";
let flangClass = "OmpReductionClause";
}
def OMPC_InReduction : Clause<"in_reduction"> {
let clangClass = "OMPInReductionClause";
}
def OMPC_UnifiedAddress : Clause<"unified_address"> {
let clangClass = "OMPUnifiedAddressClause";
}
def OMPC_UnifiedSharedMemory : Clause<"unified_shared_memory"> {
let clangClass = "OMPUnifiedSharedMemoryClause";
}
def OMPC_ReverseOffload : Clause<"reverse_offload"> {
let clangClass = "OMPReverseOffloadClause";
}
def OMPC_DynamicAllocators : Clause<"dynamic_allocators"> {
let clangClass = "OMPDynamicAllocatorsClause";
}
def OMPC_AtomicDefaultMemOrder : Clause<"atomic_default_mem_order"> {
let clangClass = "OMPAtomicDefaultMemOrderClause";
}
def OMPC_Allocate : Clause<"allocate"> {
let clangClass = "OMPAllocateClause";
let flangClass = "OmpAllocateClause";
}
def OMPC_NonTemporal : Clause<"nontemporal"> {
let clangClass = "OMPNontemporalClause";
}
def OMP_ORDER_concurrent : ClauseVal<"default",2,0> { let isDefault = 1; }
def OMPC_Order : Clause<"order"> {
let clangClass = "OMPOrderClause";
let enumClauseValue = "OrderKind";
let allowedClauseValues = [
OMP_ORDER_concurrent
];
}
def OMPC_Init : Clause<"init"> {
let clangClass = "OMPInitClause";
}
def OMPC_Use : Clause<"use"> {
let clangClass = "OMPUseClause";
}
def OMPC_Destroy : Clause<"destroy"> {
let clangClass = "OMPDestroyClause";
}
def OMPC_Novariants : Clause<"novariants"> {
let clangClass = "OMPNovariantsClause";
let flangClass = "ScalarLogicalExpr";
}
def OMPC_Nocontext : Clause<"nocontext"> {
let clangClass = "OMPNocontextClause";
let flangClass = "ScalarLogicalExpr";
}
def OMPC_Detach : Clause<"detach"> {
let clangClass = "OMPDetachClause";
}
def OMPC_Inclusive : Clause<"inclusive"> {
let clangClass = "OMPInclusiveClause";
}
def OMPC_Exclusive : Clause<"exclusive"> {
let clangClass = "OMPExclusiveClause";
}
def OMPC_UsesAllocators : Clause<"uses_allocators"> {
let clangClass = "OMPUsesAllocatorsClause";
}
def OMPC_Affinity : Clause<"affinity"> {
let clangClass = "OMPAffinityClause";
}
def OMPC_UseDeviceAddr : Clause<"use_device_addr"> {
let clangClass = "OMPUseDeviceAddrClause";
}
def OMPC_Uniform : Clause<"uniform"> {
let flangClass = "Name";
let isValueList = true;
}
def OMPC_DeviceType : Clause<"device_type"> {}
def OMPC_Match : Clause<"match"> {}
def OMPC_Depobj : Clause<"depobj"> {
let clangClass = "OMPDepobjClause";
let isImplicit = true;
}
def OMPC_Flush : Clause<"flush"> {
let clangClass = "OMPFlushClause";
let isImplicit = true;
}
def OMPC_ThreadPrivate : Clause<"threadprivate"> {
let alternativeName = "threadprivate or thread local";
let isImplicit = true;
}
def OMPC_Unknown : Clause<"unknown"> {
let isImplicit = true;
let isDefault = true;
}
def OMPC_Link : Clause<"link"> {
let flangClass = "OmpObjectList";
}
def OMPC_Inbranch : Clause<"inbranch"> {}
def OMPC_Notinbranch : Clause<"notinbranch"> {}
def OMPC_Filter : Clause<"filter"> {
let clangClass = "OMPFilterClause";
let flangClass = "ScalarIntExpr";
}
//===----------------------------------------------------------------------===//
// Definition of OpenMP directives
//===----------------------------------------------------------------------===//
def OMP_ThreadPrivate : Directive<"threadprivate"> {}
def OMP_Parallel : Directive<"parallel"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
];
}
def OMP_Task : Directive<"task"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_InReduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Detach, 50>,
VersionedClause<OMPC_Affinity, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Priority>
];
}
def OMP_Simd : Directive<"simd"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_If, 50>,
];
}
[OpenMP] Implement '#pragma omp tile', by Michael Kruse (@Meinersbur). The tile directive is in OpenMP's Technical Report 8 and foreseeably will be part of the upcoming OpenMP 5.1 standard. This implementation is based on an AST transformation providing a de-sugared loop nest. This makes it simple to forward the de-sugared transformation to loop associated directives taking the tiled loops. In contrast to other loop associated directives, the OMPTileDirective does not use CapturedStmts. Letting loop associated directives consume loops from different capture context would be difficult. A significant amount of code generation logic is taking place in the Sema class. Eventually, I would prefer if these would move into the CodeGen component such that we could make use of the OpenMPIRBuilder, together with flang. Only expressions converting between the language's iteration variable and the logical iteration space need to take place in the semantic analyzer: Getting the of iterations (e.g. the overload resolution of `std::distance`) and converting the logical iteration number to the iteration variable (e.g. overload resolution of `iteration + .omp.iv`). In clang, only CXXForRangeStmt is also represented by its de-sugared components. However, OpenMP loop are not defined as syntatic sugar. Starting with an AST-based approach allows us to gradually move generated AST statements into CodeGen, instead all at once. I would also like to refactor `checkOpenMPLoop` into its functionalities in a follow-up. In this patch it is used twice. Once for checking proper nesting and emitting diagnostics, and additionally for deriving the logical iteration space per-loop (instead of for the loop nest). Differential Revision: https://reviews.llvm.org/D76342
2021-02-12 20:26:59 +01:00
def OMP_Tile : Directive<"tile"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Sizes, 51>,
];
}
def OMP_Unroll : Directive<"unroll"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Full, 51>,
VersionedClause<OMPC_Partial, 51>,
];
}
def OMP_For : Directive<"for"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_Do : Directive<"do"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Reduction>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_NoWait>
];
}
def OMP_Sections : Directive<"sections"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_Section : Directive<"section"> {}
def OMP_Single : Directive<"single"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_CopyPrivate>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_Master : Directive<"master"> {}
def OMP_Critical : Directive<"critical"> {
let allowedClauses = [
VersionedClause<OMPC_Hint>
];
}
def OMP_TaskYield : Directive<"taskyield"> {}
def OMP_Barrier : Directive<"barrier"> {}
def OMP_TaskWait : Directive<"taskwait"> {
let allowedClauses = [
VersionedClause<OMPC_Depend, 50>
];
}
def OMP_TaskGroup : Directive<"taskgroup"> {
let allowedClauses = [
VersionedClause<OMPC_TaskReduction>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_Flush : Directive<"flush"> {
let allowedOnceClauses = [
VersionedClause<OMPC_AcqRel, 50>,
VersionedClause<OMPC_Acquire, 50>,
VersionedClause<OMPC_Release, 50>,
// TODO This should ne `none` instead. Comment carried over from
// OMPKinds.def.
VersionedClause<OMPC_Flush>
];
}
def OMP_Ordered : Directive<"ordered"> {
let allowedClauses = [
VersionedClause<OMPC_Threads>,
VersionedClause<OMPC_Simd>,
VersionedClause<OMPC_Depend>
];
}
def OMP_Atomic : Directive<"atomic"> {
let allowedClauses = [
VersionedClause<OMPC_Read>,
VersionedClause<OMPC_Write>,
VersionedClause<OMPC_Update>,
VersionedClause<OMPC_Capture>,
];
let allowedOnceClauses = [
VersionedClause<OMPC_SeqCst>,
VersionedClause<OMPC_AcqRel, 50>,
VersionedClause<OMPC_Acquire, 50>,
VersionedClause<OMPC_Release, 50>,
VersionedClause<OMPC_Relaxed, 50>,
VersionedClause<OMPC_Hint, 50>
];
}
def OMP_Target : Directive<"target"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NoWait>
];
}
def OMP_Teams : Directive<"teams"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>
];
}
def OMP_Cancel : Directive<"cancel"> {
let allowedClauses = [
VersionedClause<OMPC_If>
];
}
def OMP_Requires : Directive<"requires"> {
let allowedClauses = [
VersionedClause<OMPC_UnifiedAddress>,
VersionedClause<OMPC_UnifiedSharedMemory>,
VersionedClause<OMPC_ReverseOffload>,
VersionedClause<OMPC_DynamicAllocators>,
VersionedClause<OMPC_AtomicDefaultMemOrder>
];
}
def OMP_TargetData : Directive<"target data"> {
let allowedClauses = [
VersionedClause<OMPC_UseDevicePtr>,
VersionedClause<OMPC_UseDeviceAddr, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_If>
];
let requiredClauses = [
VersionedClause<OMPC_Map>
];
}
def OMP_TargetEnterData : Directive<"target enter data"> {
let allowedClauses = [
VersionedClause<OMPC_Depend>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_NoWait>
];
let requiredClauses = [
VersionedClause<OMPC_Map>
];
}
def OMP_TargetExitData : Directive<"target exit data"> {
let allowedClauses = [
VersionedClause<OMPC_Depend>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NoWait>
];
let requiredClauses = [
VersionedClause<OMPC_Map>
];
}
def OMP_TargetParallel : Directive<"target parallel"> {
let allowedClauses = [
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>
];
}
def OMP_TargetParallelFor : Directive<"target parallel for"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_UsesAllocators, 50>
];
}
def OMP_TargetParallelDo : Directive<"target parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Allocator>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_UsesAllocators>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Copyin>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_NoWait>
];
}
def OMP_TargetUpdate : Directive<"target update"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_To>,
VersionedClause<OMPC_From>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>
];
}
def OMP_ParallelFor : Directive<"parallel for"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_ParallelDo : Directive<"parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Collapse>
];
}
def OMP_ParallelForSimd : Directive<"parallel for simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_ParallelDoSimd : Directive<"parallel do simd"> {
let allowedClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal>,
VersionedClause<OMPC_Order>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>
];
}
def OMP_ParallelMaster : Directive<"parallel master"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_ParallelSections : Directive<"parallel sections"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_NumThreads>
];
}
def OMP_ForSimd : Directive<"for simd"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_If, 50>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
];
}
def OMP_DoSimd : Directive<"do simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Reduction>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_NoWait>
];
}
def OMP_CancellationPoint : Directive<"cancellation point"> {}
def OMP_DeclareReduction : Directive<"declare reduction"> {}
def OMP_DeclareMapper : Directive<"declare mapper"> {
let allowedClauses = [
VersionedClause<OMPC_Map>
];
}
def OMP_DeclareSimd : Directive<"declare simd"> {
let allowedClauses = [
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Uniform>
];
let allowedOnceClauses = [
VersionedClause<OMPC_SimdLen>
];
let allowedExclusiveClauses = [
VersionedClause<OMPC_Inbranch>,
VersionedClause<OMPC_Notinbranch>
];
}
def OMP_TaskLoop : Directive<"taskloop"> {
let allowedClauses = [
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_InReduction>,
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Priority>,
];
let allowedExclusiveClauses = [
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NumTasks>
];
}
def OMP_TaskLoopSimd : Directive<"taskloop simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_InReduction>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Untied>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Priority>
];
let allowedExclusiveClauses = [
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NumTasks>
];
}
def OMP_Distribute : Directive<"distribute"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>
];
}
[OpenMP] Overhaul `declare target` handling This patch fixes various issues with our prior `declare target` handling and extends it to support `omp begin declare target` as well. This started with PR49649 in mind, trying to provide a way for users to avoid the "ref" global use introduced for globals with internal linkage. From there it went down the rabbit hole, e.g., all variables, even `nohost` ones, were emitted into the device code so it was impossible to determine if "ref" was needed late in the game (based on the name only). To make it really useful, `begin declare target` was needed as it can carry the `device_type`. Not emitting variables eagerly had a ripple effect. Finally, the precedence of the (explicit) declare target list items needed to be taken into account, that meant we cannot just look for any declare target attribute to make a decision. This caused the handling of functions to require fixup as well. I tried to clean up things while I was at it, e.g., we should not "parse declarations and defintions" as part of OpenMP parsing, this will always break at some point. Instead, we keep track what region we are in and act on definitions and declarations instead, this is what we do for declare variant and other begin/end directives already. Highlights: - new diagnosis for restrictions specificed in the standard, - delayed emission of globals not mentioned in an explicit list of a declare target, - omission of `nohost` globals on the host and `host` globals on the device, - no explicit parsing of declarations in-between `omp [begin] declare variant` and the corresponding end anymore, regular parsing instead, - precedence for explicit mentions in `declare target` lists over implicit mentions in the declaration-definition-seq, and - `omp allocate` declarations will now replace an earlier emitted global, if necessary. --- Notes: The patch is larger than I hoped but it turns out that most changes do on their own lead to "inconsistent states", which seem less desirable overall. After working through this I feel the standard should remove the explicit declare target forms as the delayed emission is horrible. That said, while we delay things anyway, it seems to me we check too often for the current status even though that is often not sufficient to act upon. There seems to be a lot of duplication that can probably be trimmed down. Eagerly emitting some things seems pretty weak as an argument to keep so much logic around. --- Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D101030
2021-04-22 07:57:28 +02:00
def OMP_BeginDeclareTarget : Directive<"begin declare target"> {
let allowedClauses = [
VersionedClause<OMPC_To>,
VersionedClause<OMPC_Link>,
VersionedClause<OMPC_DeviceType>,
];
}
def OMP_DeclareTarget : Directive<"declare target"> {
let allowedClauses = [
VersionedClause<OMPC_To>,
VersionedClause<OMPC_Link>
];
}
def OMP_EndDeclareTarget : Directive<"end declare target"> {}
def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
let allowedClauses = [
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Linear>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>
];
}
def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
let allowedClauses = [
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
let allowedClauses = [
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal>,
VersionedClause<OMPC_Order>
];
}
def OMP_DistributeSimd : Directive<"distribute simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If, 50>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>
];
}
def OMP_TargetParallelForSimd : Directive<"target parallel for simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_UsesAllocators, 50>
];
}
def OMP_TargetParallelDoSimd : Directive<"target parallel do simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_UsesAllocators>
];
}
def OMP_TargetSimd : Directive<"target simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_UsesAllocators, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Schedule>
];
}
def OMP_TeamsDistribute : Directive<"teams distribute"> {
let allowedClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_TeamsDistributeSimd : Directive<"teams distribute simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If, 50>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_ThreadLimit>
];
}
def OMP_TeamsDistributeParallelForSimd :
Directive<"teams distribute parallel for simd"> {
let allowedClauses = [
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_TeamsDistributeParallelDoSimd :
Directive<"teams distribute parallel do simd"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_NonTemporal>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_If>,
];
}
def OMP_TeamsDistributeParallelFor :
Directive<"teams distribute parallel for"> {
let allowedClauses = [
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_TeamsDistributeParallelDo :
Directive<"teams distribute parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Linear>
];
let allowedOnceClauses = [
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>
];
}
def OMP_TargetTeams : Directive<"target teams"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators, 50>,
VersionedClause<OMPC_Shared>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>
];
}
def OMP_TargetTeamsDistribute : Directive<"target teams distribute"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators, 50>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_LastPrivate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>
];
}
def OMP_TargetTeamsDistributeParallelFor :
Directive<"target teams distribute parallel for"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_UsesAllocators, 50>
];
}
def OMP_TargetTeamsDistributeParallelDo :
Directive<"target teams distribute parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Order>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
];
}
def OMP_TargetTeamsDistributeParallelForSimd :
Directive<"target teams distribute parallel for simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_UsesAllocators, 50>
];
}
def OMP_TargetTeamsDistributeParallelDoSimd :
Directive<"target teams distribute parallel do simd"> {
let allowedClauses = [
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_UsesAllocators>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Order>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_NonTemporal>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>
];
}
def OMP_TargetTeamsDistributeSimd :
Directive<"target teams distribute simd"> {
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_UsesAllocators, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_DefaultMap>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_ThreadLimit>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_DistSchedule>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
];
}
def OMP_Allocate : Directive<"allocate"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Allocator>
];
}
def OMP_DeclareVariant : Directive<"declare variant"> {
let allowedClauses = [
VersionedClause<OMPC_Match>
];
}
def OMP_MasterTaskloop : Directive<"master taskloop"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_Priority>,
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_NumTasks>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_InReduction>,
VersionedClause<OMPC_Allocate>
];
}
def OMP_ParallelMasterTaskloop :
Directive<"parallel master taskloop"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_Priority>,
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_NumTasks>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Copyin>
];
}
def OMP_MasterTaskloopSimd : Directive<"master taskloop simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_Priority>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_NumTasks>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_InReduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_ParallelMasterTaskloopSimd :
Directive<"parallel master taskloop simd"> {
let allowedClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Shared>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Untied>,
VersionedClause<OMPC_Mergeable>,
VersionedClause<OMPC_Priority>,
VersionedClause<OMPC_GrainSize>,
VersionedClause<OMPC_NoGroup>,
VersionedClause<OMPC_NumTasks>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_SimdLen>,
VersionedClause<OMPC_NonTemporal, 50>,
VersionedClause<OMPC_Order, 50>
];
}
def OMP_Depobj : Directive<"depobj"> {
let allowedClauses = [
VersionedClause<OMPC_Depend, 50>,
VersionedClause<OMPC_Destroy, 50>,
VersionedClause<OMPC_Update, 50>,
// TODO This should ne `none` instead. Comment carried over from
// OMPKinds.def.
VersionedClause<OMPC_Depobj, 50>
];
}
def OMP_Scan : Directive<"scan"> {
let allowedClauses = [
VersionedClause<OMPC_Inclusive, 50>,
VersionedClause<OMPC_Exclusive, 50>
];
}
def OMP_Assumes : Directive<"assumes"> {}
def OMP_BeginAssumes : Directive<"begin assumes"> {}
def OMP_EndAssumes : Directive<"end assumes"> {}
def OMP_BeginDeclareVariant : Directive<"begin declare variant"> {}
def OMP_EndDeclareVariant : Directive<"end declare variant"> {}
def OMP_ParallelWorkshare : Directive<"parallel workshare"> {
let allowedClauses = [
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>
];
let allowedOnceClauses = [
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>
];
}
def OMP_Workshare : Directive<"workshare"> {}
def OMP_EndDo : Directive<"end do"> {}
def OMP_EndDoSimd : Directive<"end do simd"> {}
def OMP_EndSections : Directive<"end sections"> {
let allowedOnceClauses = [
VersionedClause<OMPC_NoWait>
];
}
def OMP_EndSingle : Directive<"end single"> {
let allowedClauses = [
VersionedClause<OMPC_CopyPrivate>
];
let allowedOnceClauses = [
VersionedClause<OMPC_NoWait>
];
}
def OMP_EndWorkshare : Directive<"end workshare"> {
let allowedClauses = [
VersionedClause<OMPC_NoWait>
];
}
def OMP_interop : Directive<"interop"> {
let allowedClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_Destroy>,
VersionedClause<OMPC_Init>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Use>,
];
}
def OMP_dispatch : Directive<"dispatch"> {
let allowedClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_IsDevicePtr>,
VersionedClause<OMPC_NoWait>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_Novariants>,
VersionedClause<OMPC_Nocontext>
];
}
def OMP_masked : Directive<"masked"> {
let allowedOnceClauses = [
VersionedClause<OMPC_Filter>
];
}
def OMP_Unknown : Directive<"unknown"> {
let isDefault = true;
}