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
298 lines
11 KiB
C
298 lines
11 KiB
C
// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -triple spirv64-intel -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -triple spirv64-intel -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=DEFAULT-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -DOMP52 -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -DOMP52 -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -DOMP52 -triple spirv64-intel -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52-GPU
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple spirv64-intel -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=OMP52-GPU
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
#ifdef OMP52
|
|
void bar(void);
|
|
|
|
#define N 10
|
|
void foo1(void) {
|
|
#pragma omp metadirective when(device = {kind(cpu)} \
|
|
: parallel) otherwise()
|
|
bar();
|
|
#pragma omp metadirective when(implementation = {vendor(score(0) \
|
|
: amd)}, \
|
|
device = {kind(cpu)} \
|
|
: parallel) otherwise(target teams)
|
|
bar();
|
|
#pragma omp metadirective when(device = {kind(gpu)} \
|
|
: target teams) when(implementation = {vendor(amd)} \
|
|
: parallel) otherwise()
|
|
bar();
|
|
#pragma omp metadirective otherwise(target) when(implementation = {vendor(score(5) \
|
|
: amd)}, \
|
|
device = {kind(cpu, host)} \
|
|
: parallel)
|
|
bar();
|
|
#pragma omp metadirective when(user = {condition(N > 10)} \
|
|
: target) when(user = {condition(N == 10)} \
|
|
: parallel)
|
|
bar();
|
|
#pragma omp metadirective when(device = {kind(host)} \
|
|
: parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_all)} \
|
|
: parallel) otherwise(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_any)} \
|
|
: parallel) otherwise(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_none)} \
|
|
: parallel) otherwise(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
// Test metadirective with nested OpenMP directive.
|
|
int array[16];
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for)
|
|
for (int i = 0; i < 16; i++) {
|
|
#pragma omp simd
|
|
for (int j = 0; j < 16; j++)
|
|
array[i] = i;
|
|
}
|
|
|
|
#pragma omp metadirective when(device={arch("amdgcn")}: \
|
|
teams distribute parallel for)\
|
|
otherwise(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(device={arch("spirv64")}: \
|
|
teams distribute parallel for)\
|
|
otherwise(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(implementation = {extension(match_all)} \
|
|
: nothing) otherwise(parallel for)
|
|
for (int i = 0; i < 16; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(implementation = {extension(match_any)} \
|
|
: parallel) otherwise(nothing)
|
|
for (int i = 0; i < 16; i++)
|
|
;
|
|
|
|
|
|
#pragma omp metadirective when(user = {condition(0)} \
|
|
: parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#pragma omp metadirective when(user = {condition(0)} \
|
|
: parallel for) when(implementation = {extension(match_none)} \
|
|
: parallel) otherwise(parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
|
|
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for) when(implementation = {extension(match_none)} \
|
|
: parallel) otherwise(parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
}
|
|
|
|
// OMP52: void bar(void);
|
|
// OMP52: void foo1(void)
|
|
// OMP52-NEXT: #pragma omp parallel
|
|
// OMP52-NEXT: bar()
|
|
// OMP52-NEXT: #pragma omp parallel
|
|
// OMP52-NEXT: bar()
|
|
// OMP52-NEXT: #pragma omp parallel
|
|
// OMP52-NEXT: bar()
|
|
// OMP52-NEXT: #pragma omp parallel
|
|
// OMP52-NEXT: bar()
|
|
// OMP52-NEXT: #pragma omp parallel
|
|
// OMP52-NEXT: bar()
|
|
// OMP52-NEXT: #pragma omp parallel for
|
|
// OMP52-NEXT: for (int i = 0; i < 100; i++)
|
|
// OMP52: #pragma omp parallel
|
|
// OMP52-NEXT: for (int i = 0; i < 100; i++)
|
|
// OMP52: #pragma omp parallel for
|
|
// OMP52-NEXT: for (int i = 0; i < 100; i++)
|
|
// OMP52: #pragma omp parallel
|
|
// OMP52-NEXT: for (int i = 0; i < 100; i++)
|
|
// OMP52: #pragma omp parallel for
|
|
// OMP52-NEXT: for (int i = 0; i < 16; i++) {
|
|
// OMP52-NEXT: #pragma omp simd
|
|
// OMP52-NEXT: for (int j = 0; j < 16; j++)
|
|
// OMP52-GPU: #pragma omp teams distribute parallel for
|
|
// OMP52-GPU-NEXT: for (int i = 0; i < 100; i++)
|
|
// OMP52: for (int i = 0; i < 16; i++)
|
|
// OMP52: for (int i = 0; i < 16; i++)
|
|
|
|
#else
|
|
void bar(void);
|
|
|
|
#define N 10
|
|
void foo2(void) {
|
|
#pragma omp metadirective when(device = {kind(cpu)} \
|
|
: parallel) default()
|
|
bar();
|
|
#pragma omp metadirective when(implementation = {vendor(score(0) \
|
|
: amd)}, \
|
|
device = {kind(cpu)} \
|
|
: parallel) default(target teams)
|
|
bar();
|
|
#pragma omp metadirective when(device = {kind(gpu)} \
|
|
: target teams) when(implementation = {vendor(amd)} \
|
|
: parallel) default()
|
|
bar();
|
|
#pragma omp metadirective default(target) when(implementation = {vendor(score(5) \
|
|
: amd)}, \
|
|
device = {kind(cpu, host)} \
|
|
: parallel)
|
|
bar();
|
|
#pragma omp metadirective when(user = {condition(N > 10)} \
|
|
: target) when(user = {condition(N == 10)} \
|
|
: parallel)
|
|
bar();
|
|
#pragma omp metadirective when(device = {kind(host)} \
|
|
: parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_all)} \
|
|
: parallel) default(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_any)} \
|
|
: parallel) default(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
#pragma omp metadirective when(implementation = {extension(match_none)} \
|
|
: parallel) default(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
// Test metadirective with nested OpenMP directive.
|
|
int array[16];
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for)
|
|
for (int i = 0; i < 16; i++) {
|
|
#pragma omp simd
|
|
for (int j = 0; j < 16; j++)
|
|
array[i] = i;
|
|
}
|
|
|
|
#pragma omp metadirective when(device={arch("amdgcn")}: \
|
|
teams distribute parallel for)\
|
|
default(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(device={arch("spirv64")}: \
|
|
teams distribute parallel for)\
|
|
default(parallel for)
|
|
for (int i = 0; i < 100; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(implementation = {extension(match_all)} \
|
|
: nothing) default(parallel for)
|
|
for (int i = 0; i < 16; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(implementation = {extension(match_any)} \
|
|
: parallel) default(nothing)
|
|
for (int i = 0; i < 16; i++)
|
|
;
|
|
|
|
|
|
#pragma omp metadirective when(user = {condition(0)} \
|
|
: parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#pragma omp metadirective when(user = {condition(0)} \
|
|
: parallel for) when(implementation = {extension(match_none)} \
|
|
: parallel) default(parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
|
|
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for) when(implementation = {extension(match_none)} \
|
|
: parallel) default(parallel for)
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#if _OPENMP >= 202111
|
|
#pragma omp metadirective when(user = {condition(0)} \
|
|
: parallel for) otherwise()
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
|
|
#pragma omp metadirective when(user = {condition(1)} \
|
|
: parallel for) otherwise()
|
|
for (int i=0; i<10; i++)
|
|
;
|
|
#endif
|
|
}
|
|
|
|
// DEFAULT: void bar(void);
|
|
// DEFAULT: void foo2(void)
|
|
// DEFAULT-NEXT: #pragma omp parallel
|
|
// DEFAULT-NEXT: bar()
|
|
// DEFAULT-NEXT: #pragma omp parallel
|
|
// DEFAULT-NEXT: bar()
|
|
// DEFAULT-NEXT: #pragma omp parallel
|
|
// DEFAULT-NEXT: bar()
|
|
// DEFAULT-NEXT: #pragma omp parallel
|
|
// DEFAULT-NEXT: bar()
|
|
// DEFAULT-NEXT: #pragma omp parallel
|
|
// DEFAULT-NEXT: bar()
|
|
// DEFAULT-NEXT: #pragma omp parallel for
|
|
// DEFAULT-NEXT: for (int i = 0; i < 100; i++)
|
|
// DEFAULT: #pragma omp parallel
|
|
// DEFAULT-NEXT: for (int i = 0; i < 100; i++)
|
|
// DEFAULT: #pragma omp parallel for
|
|
// DEFAULT-NEXT: for (int i = 0; i < 100; i++)
|
|
// DEFAULT: #pragma omp parallel
|
|
// DEFAULT-NEXT: for (int i = 0; i < 100; i++)
|
|
// DEFAULT: #pragma omp parallel for
|
|
// DEFAULT-NEXT: for (int i = 0; i < 16; i++) {
|
|
// DEFAULT-NEXT: #pragma omp simd
|
|
// DEFAULT-NEXT: for (int j = 0; j < 16; j++)
|
|
// DEFAULT-GPU: #pragma omp teams distribute parallel for
|
|
// DEFAULT-GPU-NEXT: for (int i = 0; i < 100; i++)
|
|
// DEFAULT: for (int i = 0; i < 16; i++)
|
|
// DEFAULT: for (int i = 0; i < 16; i++)
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|