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
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
// clang-format off
|
|
// RUN: %libomptarget-compilexx-generic -fopenmp-version=60
|
|
// RUN: %libomptarget-run-generic | %fcheck-generic
|
|
// RUN: %libomptarget-compileoptxx-generic -fopenmp-version=60
|
|
// RUN: %libomptarget-run-generic | %fcheck-generic
|
|
// clang-format on
|
|
|
|
// Sanity test for OpenMP 6.0 declare target 'local' clause.
|
|
// Verify 'local' variable has device-local storage, that it has
|
|
// correct initial value, persists across target regions, and is
|
|
// independent from host copy.
|
|
|
|
#include <cstdio>
|
|
int local_var = 42;
|
|
#pragma omp declare target local(local_var)
|
|
|
|
int main() {
|
|
// Device should get the initializer value.
|
|
int init = -1;
|
|
#pragma omp target map(from : init)
|
|
init = local_var;
|
|
|
|
// Device write should persist to a second region.
|
|
int persist = -1;
|
|
#pragma omp target
|
|
local_var = 100;
|
|
#pragma omp target map(from : persist)
|
|
persist = local_var;
|
|
|
|
// Host copy should not be affected by device write. Should
|
|
// retain original value.
|
|
|
|
// CHECK: PASS
|
|
if (init == 42 && persist == 100 && local_var == 42)
|
|
printf("PASS\n");
|
|
else
|
|
printf("FAIL init=%d persist=%d host=%d\n", init, persist, local_var);
|
|
|
|
return (init == 42 && persist == 100 && local_var == 42) ? 0 : 1;
|
|
}
|