Files
TheRock/compiler/amd-llvm/clang/test/OpenMP/task_transparent_serialization.cpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

270 lines
11 KiB
C++

// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -include-pch %t -ast-dump-all %s | FileCheck %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
typedef void **omp_impex_t;
extern const omp_impex_t omp_not_impex;
extern const omp_impex_t omp_import;
extern const omp_impex_t omp_export;
extern const omp_impex_t omp_impex;
// CHECK: FunctionDecl {{.*}} TestTaskTransparent 'void ()'
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_not_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'omp_impex_t':'void **' lvalue Var {{.*}} 'imp' 'omp_impex_t':'void **' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'omp_impex_t':'void **' lvalue Var {{.*}} 'imp' 'omp_impex_t':'void **' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// CHECK-NEXT: CapturedDecl
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: BinaryOperator {{.*}} 'int' '+'
// CHECK-NEXT: ImplicitCastExpr {{.*}} <col:30> 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: IntegerLiteral {{.*}} <col:32> 'int' 1
// CHECK-NEXT: CapturedStmt
// CHEC-NEXT: CapturedDecl
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: BinaryOperator {{.*}} 'int' '+'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: IntegerLiteral {{.*}} <col:32> 'int' 1
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr{{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
/// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
template <typename T>
class TransparentTemplate {
public:
void TestTaskLoopImpex() {
#pragma omp taskloop transparent(omp_impex)
for (int i = 0; i < 10; ++i) {}
}
};
void TestTaskTransparent() {
int a;
omp_impex_t imp;
#pragma omp task transparent(omp_not_impex)
#pragma omp task transparent(imp)
#pragma omp task transparent(a)
#pragma omp task transparent(a+1)
#pragma omp parallel
{
#pragma omp task transparent(omp_export)
{
#pragma omp taskloop transparent(omp_impex)
for (int i = 0; i < 5; ++i) {}
}
}
TransparentTemplate<int> obj;
obj.TestTaskLoopImpex();
}
// CHECK: FunctionDecl {{.*}} TestTransparentImplicitFirstprivateOnEnclosingTask1 'void ()'
// outer task (1)
// CHECK: OMPTaskDirective
// 'a' is firstprivate on outer
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// inner task (2)
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
void TestTransparentImplicitFirstprivateOnEnclosingTask1() {
int a;
#pragma omp task // (1)
{
#pragma omp task transparent(a) // (2)
{}
}
}
// CHECK: FunctionDecl {{.*}} TestTransparentImplicitFirstprivateOnEnclosingTask2 'void ()'
// outer task (1)
// CHECK: OMPTaskDirective
// 'a' is firstprivate on outer task (1)
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// inner task (2)
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// 'a' is firstprivate on outer task (2)
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// inner task (3)
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: BinaryOperator {{.*}} 'int' '+'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
// CHECK-NEXT: CapturedStmt
void TestTransparentImplicitFirstprivateOnEnclosingTask2() {
int a;
#pragma omp task // (1)
{
#pragma omp task transparent(a) // (2)
#pragma omp task transparent(a+1) // (3)
{}
}
}
// CHECK: FunctionDecl {{.*}} TestTransparentImplicitFirstprivateOnEnclosingTask3 'void ()'
// outer task (1)
// CHECK: OMPTaskDirective
// 'a' is firstprivate on outer task (1)
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// inner task (2)
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// inner task (3)
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
void TestTransparentImplicitFirstprivateOnEnclosingTask3() {
int a;
#pragma omp task // (1)
{
#pragma omp task transparent(a) // (2)
#pragma omp task transparent(omp_impex) // (3)
{}
}
}
#endif