Skip to content

[OpenACC] apply seq par dims to reduction variables#209261

Merged
rscottmanley merged 1 commit into
llvm:mainfrom
rscottmanley:rscottmanley/seq-par-dims
Jul 14, 2026
Merged

[OpenACC] apply seq par dims to reduction variables#209261
rscottmanley merged 1 commit into
llvm:mainfrom
rscottmanley:rscottmanley/seq-par-dims

Conversation

@rscottmanley

Copy link
Copy Markdown
Contributor

When the acc.parallel op is "effectively sequential" apply the correct par dims during recipe materialization of reduction variables

@llvmorg-github-actions

llvmorg-github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-openacc

@llvm/pr-subscribers-mlir

Author: Scott Manley (rscottmanley)

Changes

When the acc.parallel op is "effectively sequential" apply the correct par dims during recipe materialization of reduction variables


Full diff: https://github.com/llvm/llvm-project/pull/209261.diff

3 Files Affected:

  • (modified) mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h (+14)
  • (modified) mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp (+10-6)
  • (modified) mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir (+32)
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h b/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
index 64de4eda7366a..a0a483e914a77 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
@@ -15,6 +15,7 @@
 #define MLIR_DIALECT_OPENACC_OPENACCUTILSCG_H_
 
 #include "mlir/Dialect/OpenACC/OpenACC.h"
+#include "mlir/Dialect/OpenACC/OpenACCParMapping.h"
 #include "mlir/IR/IRMapping.h"
 #include "mlir/Interfaces/DataLayoutInterfaces.h"
 #include "llvm/ADT/SmallVector.h"
@@ -90,6 +91,19 @@ void updateParDimsAttr(Operation *op, GPUParallelDimsAttr attr);
 /// Copy parallel dimensions from \p from to \p to.
 void copyParDimsAttr(Operation *from, Operation *to);
 
+/// Create a gang dim 1 GPUParallelDimsAttr based on the mapping policy.
+inline GPUParallelDimsAttr
+getGangDim1ParDimsAttr(MLIRContext *ctx, ACCToGPUMappingPolicy &policy) {
+  return GPUParallelDimsAttr::get(
+      ctx, {policy.gangDim(ctx, acc::ParLevel::gang_dim1)});
+}
+
+/// Create a sequential GPUParallelDimsAttr based on the mapping policy.
+inline GPUParallelDimsAttr getSeqParDimsAttr(MLIRContext *ctx,
+                                             ACCToGPUMappingPolicy &policy) {
+  return GPUParallelDimsAttr::get(ctx, {policy.seqDim(ctx)});
+}
+
 } // namespace acc
 } // namespace mlir
 
diff --git a/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp b/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
index d2e8d77c168d1..e666bcd9a6242 100644
--- a/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
+++ b/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
@@ -383,25 +383,29 @@ LogicalResult ACCRecipeMaterialization::materialize(
     cloneRegionIntoAccRegion(&combinerRegion, &combineRegionOp.getRegion(),
                              /*hasResult=*/false);
 
-    auto ctx = b.getContext();
+    auto *ctx = b.getContext();
 
     // For reductions that come from parallel constructs, explicitly set the
     // GPU parallel dimensions attribute to blockXDim since they will always be
     // gang private. GPU parallel dimensions cannot be determined for acc.loop
     // at this point.
     if constexpr (std::is_same_v<AccOpTy, acc::ParallelOp>) {
-      auto parDimsAttr = acc::GPUParallelDimsAttr::get(
-          ctx, {policy.gangDim(ctx, acc::ParLevel::gang_dim1)});
+      acc::GPUParallelDimsAttr parDimsAttr;
+      if (accOp.isEffectivelySerial()) {
+        // If acc.serial has been lowered to a parallel op that is effectively
+        // sequential
+        parDimsAttr = acc::getSeqParDimsAttr(ctx, policy);
+      } else {
+        parDimsAttr = acc::getGangDim1ParDimsAttr(ctx, policy);
+      }
       acc::setParDimsAttr(reductionOp, parDimsAttr);
       acc::setParDimsAttr(combineRegionOp, parDimsAttr);
     }
 
     // Set sequential parallel dimensions attribute for loops in the recipe.
-    auto seqParDimsAttr =
-        acc::GPUParallelDimsAttr::get(ctx, {policy.seqDim(ctx)});
     auto setSeqParDimsForRecipeLoops = [&](Region *r) {
       r->walk([&](LoopLikeOpInterface loopLike) {
-        acc::setParDimsAttr(loopLike, seqParDimsAttr);
+        acc::setParDimsAttr(loopLike, acc::getSeqParDimsAttr(ctx, policy));
       });
     };
     setSeqParDimsForRecipeLoops(&reductionOp.getRegion());
diff --git a/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir b/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
index 6f2bafb2b6165..e5dc884d37d20 100644
--- a/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
+++ b/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
@@ -51,3 +51,35 @@ func.func @par_reduction_clause_(%arg0: memref<f64>) {
   }
   return
 }
+
+// CHECK-LABEL: func.func @par_reduction_clause_serial
+// CHECK:       acc.parallel {{.*}} {
+// CHECK:       [[PRIVATE:%.*]] = acc.reduction_init {{.*}} <add>
+// CHECK-NEXT:  [[ZERO:%.*]] = arith.constant 0.000000e+00 : f64
+// CHECK-NEXT:  [[ALLOCA:%.*]] = memref.alloca() : memref<f64>
+// CHECK-NEXT:  memref.store [[ZERO]], [[ALLOCA]][]
+// CHECK-NEXT:  acc.yield {{.*}}
+// CHECK:       } {{.*}}acc.par_dims = #acc<par_dims[sequential]>, acc.var_name = #acc.var_name<"tmp">
+// CHECK:       memref.load [[PRIVATE]][]
+// CHECK:       memref.store {{.*}}, [[PRIVATE]][]
+// CHECK:       acc.reduction_combine_region [[PRIVATE]] into [[REDUCVAR:%.*]] : memref<f64> {
+// CHECK:       [[LOADVAR:%.*]] = memref.load [[REDUCVAR]][]
+// CHECK-NEXT:  [[LOADPRIV:%.*]] = memref.load [[PRIVATE]][]
+// CHECK-NEXT:  [[COMBINE:%.*]] = arith.addf [[LOADVAR]], [[LOADPRIV]]
+// CHECK-NEXT:  memref.store [[COMBINE]], [[REDUCVAR]][]
+// CHECK-NEXT:  } {acc.par_dims = #acc<par_dims[sequential]>}
+// CHECK-NEXT:  memref.dealloc [[PRIVATE]] : memref<f64>
+// CHECK:       acc.yield
+
+func.func @par_reduction_clause_serial(%arg0: memref<f64>) {
+  %c1_i32 = arith.constant 1 : i32
+  %cst = arith.constant 1.000000e+00 : f64
+  %red = acc.reduction varPtr(%arg0 : memref<f64>) recipe(@reduction_add_memref_f64) -> memref<f64> {name = "tmp"}
+  acc.parallel num_gangs({%c1_i32 : i32}) num_workers(%c1_i32 : i32) vector_length(%c1_i32 : i32) reduction(%red : memref<f64>) {
+    %3 = memref.load %red[] : memref<f64>
+    %4 = arith.addf %3, %cst fastmath<contract> : f64
+    memref.store %4, %red[] : memref<f64>
+    acc.yield
+  }
+  return
+}

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-openacc

Author: Scott Manley (rscottmanley)

Changes

When the acc.parallel op is "effectively sequential" apply the correct par dims during recipe materialization of reduction variables


Full diff: https://github.com/llvm/llvm-project/pull/209261.diff

3 Files Affected:

  • (modified) mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h (+14)
  • (modified) mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp (+10-6)
  • (modified) mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir (+32)
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h b/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
index 64de4eda7366a..a0a483e914a77 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h
@@ -15,6 +15,7 @@
 #define MLIR_DIALECT_OPENACC_OPENACCUTILSCG_H_
 
 #include "mlir/Dialect/OpenACC/OpenACC.h"
+#include "mlir/Dialect/OpenACC/OpenACCParMapping.h"
 #include "mlir/IR/IRMapping.h"
 #include "mlir/Interfaces/DataLayoutInterfaces.h"
 #include "llvm/ADT/SmallVector.h"
@@ -90,6 +91,19 @@ void updateParDimsAttr(Operation *op, GPUParallelDimsAttr attr);
 /// Copy parallel dimensions from \p from to \p to.
 void copyParDimsAttr(Operation *from, Operation *to);
 
+/// Create a gang dim 1 GPUParallelDimsAttr based on the mapping policy.
+inline GPUParallelDimsAttr
+getGangDim1ParDimsAttr(MLIRContext *ctx, ACCToGPUMappingPolicy &policy) {
+  return GPUParallelDimsAttr::get(
+      ctx, {policy.gangDim(ctx, acc::ParLevel::gang_dim1)});
+}
+
+/// Create a sequential GPUParallelDimsAttr based on the mapping policy.
+inline GPUParallelDimsAttr getSeqParDimsAttr(MLIRContext *ctx,
+                                             ACCToGPUMappingPolicy &policy) {
+  return GPUParallelDimsAttr::get(ctx, {policy.seqDim(ctx)});
+}
+
 } // namespace acc
 } // namespace mlir
 
diff --git a/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp b/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
index d2e8d77c168d1..e666bcd9a6242 100644
--- a/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
+++ b/mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp
@@ -383,25 +383,29 @@ LogicalResult ACCRecipeMaterialization::materialize(
     cloneRegionIntoAccRegion(&combinerRegion, &combineRegionOp.getRegion(),
                              /*hasResult=*/false);
 
-    auto ctx = b.getContext();
+    auto *ctx = b.getContext();
 
     // For reductions that come from parallel constructs, explicitly set the
     // GPU parallel dimensions attribute to blockXDim since they will always be
     // gang private. GPU parallel dimensions cannot be determined for acc.loop
     // at this point.
     if constexpr (std::is_same_v<AccOpTy, acc::ParallelOp>) {
-      auto parDimsAttr = acc::GPUParallelDimsAttr::get(
-          ctx, {policy.gangDim(ctx, acc::ParLevel::gang_dim1)});
+      acc::GPUParallelDimsAttr parDimsAttr;
+      if (accOp.isEffectivelySerial()) {
+        // If acc.serial has been lowered to a parallel op that is effectively
+        // sequential
+        parDimsAttr = acc::getSeqParDimsAttr(ctx, policy);
+      } else {
+        parDimsAttr = acc::getGangDim1ParDimsAttr(ctx, policy);
+      }
       acc::setParDimsAttr(reductionOp, parDimsAttr);
       acc::setParDimsAttr(combineRegionOp, parDimsAttr);
     }
 
     // Set sequential parallel dimensions attribute for loops in the recipe.
-    auto seqParDimsAttr =
-        acc::GPUParallelDimsAttr::get(ctx, {policy.seqDim(ctx)});
     auto setSeqParDimsForRecipeLoops = [&](Region *r) {
       r->walk([&](LoopLikeOpInterface loopLike) {
-        acc::setParDimsAttr(loopLike, seqParDimsAttr);
+        acc::setParDimsAttr(loopLike, acc::getSeqParDimsAttr(ctx, policy));
       });
     };
     setSeqParDimsForRecipeLoops(&reductionOp.getRegion());
diff --git a/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir b/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
index 6f2bafb2b6165..e5dc884d37d20 100644
--- a/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
+++ b/mlir/test/Dialect/OpenACC/acc-recipe-materialization-reduction.mlir
@@ -51,3 +51,35 @@ func.func @par_reduction_clause_(%arg0: memref<f64>) {
   }
   return
 }
+
+// CHECK-LABEL: func.func @par_reduction_clause_serial
+// CHECK:       acc.parallel {{.*}} {
+// CHECK:       [[PRIVATE:%.*]] = acc.reduction_init {{.*}} <add>
+// CHECK-NEXT:  [[ZERO:%.*]] = arith.constant 0.000000e+00 : f64
+// CHECK-NEXT:  [[ALLOCA:%.*]] = memref.alloca() : memref<f64>
+// CHECK-NEXT:  memref.store [[ZERO]], [[ALLOCA]][]
+// CHECK-NEXT:  acc.yield {{.*}}
+// CHECK:       } {{.*}}acc.par_dims = #acc<par_dims[sequential]>, acc.var_name = #acc.var_name<"tmp">
+// CHECK:       memref.load [[PRIVATE]][]
+// CHECK:       memref.store {{.*}}, [[PRIVATE]][]
+// CHECK:       acc.reduction_combine_region [[PRIVATE]] into [[REDUCVAR:%.*]] : memref<f64> {
+// CHECK:       [[LOADVAR:%.*]] = memref.load [[REDUCVAR]][]
+// CHECK-NEXT:  [[LOADPRIV:%.*]] = memref.load [[PRIVATE]][]
+// CHECK-NEXT:  [[COMBINE:%.*]] = arith.addf [[LOADVAR]], [[LOADPRIV]]
+// CHECK-NEXT:  memref.store [[COMBINE]], [[REDUCVAR]][]
+// CHECK-NEXT:  } {acc.par_dims = #acc<par_dims[sequential]>}
+// CHECK-NEXT:  memref.dealloc [[PRIVATE]] : memref<f64>
+// CHECK:       acc.yield
+
+func.func @par_reduction_clause_serial(%arg0: memref<f64>) {
+  %c1_i32 = arith.constant 1 : i32
+  %cst = arith.constant 1.000000e+00 : f64
+  %red = acc.reduction varPtr(%arg0 : memref<f64>) recipe(@reduction_add_memref_f64) -> memref<f64> {name = "tmp"}
+  acc.parallel num_gangs({%c1_i32 : i32}) num_workers(%c1_i32 : i32) vector_length(%c1_i32 : i32) reduction(%red : memref<f64>) {
+    %3 = memref.load %red[] : memref<f64>
+    %4 = arith.addf %3, %cst fastmath<contract> : f64
+    memref.store %4, %red[] : memref<f64>
+    acc.yield
+  }
+  return
+}

Comment thread mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsCG.h

@razvanlupusoru razvanlupusoru left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

When the acc.parallel op is "effectively sequential" apply the correct
par dims during recipe materialization of reduction variables
@rscottmanley rscottmanley force-pushed the rscottmanley/seq-par-dims branch from 6ef1c36 to 3d19a90 Compare July 14, 2026 12:40
@rscottmanley rscottmanley merged commit 2e86804 into llvm:main Jul 14, 2026
11 checks passed
@llvm-ci

llvm-ci commented Jul 14, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder amdgpu-offload-build-only running on AMD-bb-w-01 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/226/builds/12880

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
CMake Error at /usr/local/therock-tools/share/cmake-3.27/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /usr/local/therock-tools/share/cmake-3.27/Modules/CMakeTestFortranCompiler.cmake:20 (CMAKE_DETERMINE_COMPILER_ABI)
  cmake/config-Fortran.cmake:157 (enable_language)
  CMakeLists.txt:297 (include)


-- Configuring incomplete, errors occurred!
[8681/8706] Creating library symlink lib/libflangPasses.so
FAILED: runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure 
cd /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-bins && /usr/local/therock-tools/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang -DCMAKE_Fortran_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/flang -DCMAKE_LINKER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/ld.lld -DCMAKE_AR=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-ranlib -DCMAKE_NM=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-strip -DCMAKE_READELF=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_CXX_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_Fortran_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_ASM_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_INSTALL_PREFIX=/tmp/llvm.install.test -DLLVM_BINARY_DIR=/home/botworker/bbot/amdgpu-offload-build-only/build -DLLVM_CONFIG_PATH=/home/botworker/bbot/amdgpu-offload-build-only/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF "-DLLVM_LIT_ARGS=-v --show-unsupported --timeout 100 --show-xfail -j 16" -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=23.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_Fortran_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_RUNTIMES_TARGET=amdgpu-amd-amdhsa -DHAVE_LLVM_LIT=ON -DCLANG_RESOURCE_DIR= -DLLVM_LIBDIR_SUFFIX= -DLLVM_DEFAULT_TARGET_TRIPLE=amdgpu-amd-amdhsa -DFORTRAN_SUPPORTS_REAL16=0 "-DLLVM_ENABLE_RUNTIMES=compiler-rt;openmp;offload;flang-rt" -DLLVM_USE_LINKER= -DLLVM_ENABLE_RUNTIMES=openmp -GNinja -C/home/botworker/bbot/amdgpu-offload-build-only/build/projects/runtimes-amdgpu-amd-amdhsa/tmp/runtimes-amdgpu-amd-amdhsa-cache-Release.cmake -S /home/botworker/bbot/amdgpu-offload-build-only/llvm-project/llvm/runtimes/../../runtimes -B /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-bins && /usr/local/therock-tools/bin/cmake -E touch /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure
[8683/8706] Linking CXX shared library lib/libflangFrontend.so.23.0git
[8684/8706] Linking CXX executable bin/tco
[8685/8706] Linking CXX executable bin/fir-opt
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
Step 7 (build cmake config) failure: build cmake config (failure)
...
Missing variable is:
CMAKE_Fortran_PREPROCESS_SOURCE
CMake Error at /usr/local/therock-tools/share/cmake-3.27/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /usr/local/therock-tools/share/cmake-3.27/Modules/CMakeTestFortranCompiler.cmake:20 (CMAKE_DETERMINE_COMPILER_ABI)
  cmake/config-Fortran.cmake:157 (enable_language)
  CMakeLists.txt:297 (include)
-- Configuring incomplete, errors occurred!
[8681/8706] Creating library symlink lib/libflangPasses.so
FAILED: runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure 
cd /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-bins && /usr/local/therock-tools/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/clang -DCMAKE_Fortran_COMPILER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/flang -DCMAKE_LINKER=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/ld.lld -DCMAKE_AR=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-ranlib -DCMAKE_NM=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-strip -DCMAKE_READELF=/home/botworker/bbot/amdgpu-offload-build-only/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_CXX_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_Fortran_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_ASM_COMPILER_TARGET=amdgpu-amd-amdhsa -DCMAKE_INSTALL_PREFIX=/tmp/llvm.install.test -DLLVM_BINARY_DIR=/home/botworker/bbot/amdgpu-offload-build-only/build -DLLVM_CONFIG_PATH=/home/botworker/bbot/amdgpu-offload-build-only/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF "-DLLVM_LIT_ARGS=-v --show-unsupported --timeout 100 --show-xfail -j 16" -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=23.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_Fortran_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_RUNTIMES_TARGET=amdgpu-amd-amdhsa -DHAVE_LLVM_LIT=ON -DCLANG_RESOURCE_DIR= -DLLVM_LIBDIR_SUFFIX= -DLLVM_DEFAULT_TARGET_TRIPLE=amdgpu-amd-amdhsa -DFORTRAN_SUPPORTS_REAL16=0 "-DLLVM_ENABLE_RUNTIMES=compiler-rt;openmp;offload;flang-rt" -DLLVM_USE_LINKER= -DLLVM_ENABLE_RUNTIMES=openmp -GNinja -C/home/botworker/bbot/amdgpu-offload-build-only/build/projects/runtimes-amdgpu-amd-amdhsa/tmp/runtimes-amdgpu-amd-amdhsa-cache-Release.cmake -S /home/botworker/bbot/amdgpu-offload-build-only/llvm-project/llvm/runtimes/../../runtimes -B /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-bins && /usr/local/therock-tools/bin/cmake -E touch /home/botworker/bbot/amdgpu-offload-build-only/build/runtimes/runtimes-amdgpu-amd-amdhsa-stamps/runtimes-amdgpu-amd-amdhsa-configure
[8683/8706] Linking CXX shared library lib/libflangFrontend.so.23.0git
[8684/8706] Linking CXX executable bin/tco
[8685/8706] Linking CXX executable bin/fir-opt
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
program finished with exit code 0
elapsedTime=78.244973

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants