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
81 lines
2.4 KiB
ReStructuredText
81 lines
2.4 KiB
ReStructuredText
.. _omp121:
|
|
|
|
Value has potential side effects preventing SPMD-mode execution. Add `[[omp::assume(\"ompx_spmd_amenable\")]]` to the called function to override. [OMP121]
|
|
===================================================================================================================================================================
|
|
|
|
This analysis remarks indicates that a potential side-effect that cannot be
|
|
guarded prevents the target region from executing in SPMD-mode. SPMD-mode
|
|
requires that each thread is active inside the region. Any instruction that
|
|
cannot be either recomputed by each thread independently or guarded and executed
|
|
by a single thread prevents the region from executing in SPMD-mode.
|
|
|
|
This remark will attempt to print out the instructions preventing the region
|
|
from being executed in SPMD-mode. Calls to functions outside the current
|
|
translation unit will prevent this transformation from occurring as well, but
|
|
can be overridden using an assumption stating that it contains no calls that
|
|
prevent SPMD execution.
|
|
|
|
Examples
|
|
--------
|
|
|
|
Calls to functions outside the current translation unit may contain instructions
|
|
or operations that cannot be executed in SPMD-mode.
|
|
|
|
.. code-block:: c++
|
|
|
|
extern int work();
|
|
|
|
void use(int x);
|
|
|
|
void foo() {
|
|
#pragma omp target teams
|
|
{
|
|
int x = work();
|
|
#pragma omp parallel
|
|
use(x);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
$ clang++ -fopenmp -fopenmp-targets=nvptx64 -O2 -Rpass-analysis=openmp-opt omp121.cpp
|
|
omp121.cpp:8:13: remark: Value has potential side effects preventing SPMD-mode
|
|
execution. Add `[[omp::assume("ompx_spmd_amenable")]]` to the called function
|
|
to override. [OMP121]
|
|
int x = work();
|
|
^
|
|
|
|
As the remark suggests, the problem is caused by the unknown call to the
|
|
external function ``work``. This can be overridden by asserting that it does not
|
|
contain any code that prevents SPMD-mode execution.
|
|
|
|
.. code-block:: c++
|
|
|
|
[[omp::assume("ompx_spmd_amenable")]] extern int work();
|
|
|
|
void use(int x);
|
|
|
|
void foo() {
|
|
#pragma omp target teams
|
|
{
|
|
int x = work();
|
|
#pragma omp parallel
|
|
use(x);
|
|
|
|
}
|
|
}
|
|
|
|
.. code-block:: console
|
|
|
|
$ clang++ -fopenmp -fopenmp-targets=nvptx64 -O2 -Rpass=openmp-opt omp121.cpp
|
|
omp121.cpp:6:1: remark: Transformed generic-mode kernel to SPMD-mode. [OMP120]
|
|
#pragma omp target teams
|
|
^
|
|
|
|
Diagnostic Scope
|
|
----------------
|
|
|
|
OpenMP target offloading analysis remark.
|