Files
TheRock/compiler/amd-llvm/clang/test/SemaOpenACC/loop-construct-worker-clause.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

209 lines
6.2 KiB
C++

// RUN: %clang_cc1 %s -fopenacc -verify
template<unsigned I, typename NotInt, typename ConvertsToInt, typename Int>
void TemplUses(NotInt NI, ConvertsToInt CTI, Int IsI) {
int i;
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}}
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}}
#pragma acc loop worker(num:IsI)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(CTI)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(IsI)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(I)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
// expected-error@+1{{OpenACC clause 'worker' requires expression of integer type ('NoConvert' invalid)}}
#pragma acc loop worker(NI)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
// expected-error@+3{{'num' argument to 'worker' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'num_workers' clause}}
// expected-note@+1{{previous 'num_workers' clause is here}}
#pragma acc kernels num_workers(IsI)
#pragma acc loop worker(num:CTI)
for(int i = 0; i < 5; ++i);
for(int i = 0; i < 5; ++i);
}
struct NoConvert{};
struct Converts{
operator int();
};
void uses() {
TemplUses<3>(NoConvert{}, Converts{}, 5); // expected-note{{in instantiation of function template specialization}}
#pragma acc loop worker
for(int i = 0; i < 5; ++i);
#pragma acc parallel
#pragma acc loop worker
for(int i = 0; i < 5; ++i);
int i;
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}}
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'parallel' compute construct}}
#pragma acc parallel
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}}
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'parallel' compute construct}}
#pragma acc parallel
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
#pragma acc serial
#pragma acc loop worker
for(int i = 0; i < 5; ++i);
// expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}}
#pragma acc serial
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
// expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}}
#pragma acc serial
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(i)
for(int i = 0; i < 5; ++i);
Converts Cvts;
#pragma acc kernels
#pragma acc loop worker(Cvts)
for(int i = 0; i < 5; ++i);
NoConvert NoCvts;
#pragma acc kernels
// expected-error@+1{{OpenACC clause 'worker' requires expression of integer type ('NoConvert' invalid)}}
#pragma acc loop worker(NoCvts)
for(int i = 0; i < 5; ++i);
#pragma acc kernels
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
// expected-error@+3{{'num' argument to 'worker' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'num_workers' clause}}
// expected-note@+1{{previous 'num_workers' clause is here}}
#pragma acc kernels num_workers(i)
#pragma acc loop worker(num:i)
for(int i = 0; i < 5; ++i);
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}}
// expected-note@-4 2{{previous 'worker' clause is here}}
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
#pragma acc loop vector
for(int k = 0; k < 5; ++k);
}
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
#pragma acc parallel
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc parallel
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}}
// expected-note@-4 2{{previous 'worker' clause is here}}
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc parallel
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
#pragma acc parallel
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc serial
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}}
// expected-note@-4 2{{previous 'worker' clause is here}}
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc serial
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
#pragma acc parallel
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc kernels
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}}
// expected-note@-4 2{{previous 'worker' clause is here}}
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
#pragma acc kernels
#pragma acc loop worker
for(int i= 0; i< 5; ++i) {
#pragma acc parallel
#pragma acc loop worker, gang
for(int k = 0; k < 5; ++k);
}
}