[flang-commits] [flang] [llvm] [mlir] [openmp][mlir] Expand use of atomicrmw for atomic update (PR #215654)

via flang-commits flang-commits at lists.llvm.org
Tue Aug 11 15:03:34 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 180436 tests passed
* 3583 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM-Unit
<details>
<summary>LLVM-Unit.Frontend/_/LLVMFrontendTests/36/83</summary>

```
Script(shard):
--
GTEST_OUTPUT=json:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/unittests/Frontend/./LLVMFrontendTests-LLVM-Unit-1206291-36-83.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=83 GTEST_SHARD_INDEX=36 /home/gha/actions-runner/_work/llvm-project/llvm-project/build/unittests/Frontend/./LLVMFrontendTests
--

Note: This is test shard 37 of 83.
[==========] Running 16 tests from 5 test suites.
[----------] Global test environment set-up.
[----------] 1 test from HLSLRootSignatureTest
[ RUN      ] HLSLRootSignatureTest.NoneRootFlagsDump
[       OK ] HLSLRootSignatureTest.NoneRootFlagsDump (0 ms)
[----------] 1 test from HLSLRootSignatureTest (0 ms total)

[----------] 1 test from OpenMPIRBuilderTest
[ RUN      ] OpenMPIRBuilderTest.OMPAtomicUpdateIntr
LLVMFrontendTests: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/BasicBlock.h:238: const Instruction *llvm::BasicBlock::getTerminator() const: Assertion `hasTerminator() && "cannot get terminator of non-well-formed block"' failed.
 #0 0x0000000000c23c0b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:931:13
 #1 0x0000000000c20f35 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
 #2 0x0000000000c24a1b SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:474:38
 #3 0x00007c5659947330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00007c56599a0b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #5 0x00007c565994727e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #6 0x00007c565992a8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #7 0x00007c565992a81b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #8 0x00007c565993d517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
 #9 0x0000000000951fb4 operator* /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:322:5
#10 0x0000000000951fb4 back /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/simple_ilist.h:140:41
#11 0x0000000000951fb4 hasTerminator /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/BasicBlock.h:233:42
#12 0x0000000000951fb4 getTerminator /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/BasicBlock.h:238:12
#13 0x0000000000951fb4 succ_begin /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/CFG.h:156:25
#14 0x0000000000951fb4 llvm::BasicBlock::getSingleSuccessor() const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/BasicBlock.cpp:418:28
#15 0x00000000006bd573 (anonymous namespace)::OpenMPIRBuilderTest_OMPAtomicUpdateIntr_Test::TestBody() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:4156:15
#16 0x0000000000c71d30 os_stack_trace_getter /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:6240:7
#17 0x0000000000c71d30 testing::Test::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:2695:9
#18 0x0000000000c73130 os_stack_trace_getter /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:6240:7
#19 0x0000000000c73130 testing::TestInfo::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:2842:11
#20 0x0000000000c73d43 testing::TestSuite::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:3018:35
#21 0x0000000000c84f54 testing::internal::UnitTestImpl::RunAllTests() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:5922:41
#22 0x0000000000c84309 testing::UnitTest::Run() /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/src/gtest.cc:5485:10
#23 0x0000000000c5d22a main /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/UnitTestMain/TestMain.cpp:55:3
#24 0x00007c565992c1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#25 0x00007c565992c28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#26 0x00000000005f9a55 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/unittests/Frontend/./LLVMFrontendTests+0x5f9a55)

--
exit: -6
--
shard JSON output does not exist: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/unittests/Frontend/./LLVMFrontendTests-LLVM-Unit-1206291-36-83.json
```
</details>

### MLIR
<details>
<summary>MLIR.Target/LLVMIR/openmp-llvm.mlir</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/mlir-translate -mlir-to-llvmir -split-input-file /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/mlir-translate -mlir-to-llvmir -split-input-file /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir
# .---command stderr------------
# | within split at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:4122 offset :9:8: warning: groupprivate directive is currently ignored on the host, using original global
# |   %2 = omp.groupprivate @any1 device_type(any) : !llvm.ptr
# |        ^
# | within split at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:4122 offset :9:8: note: see current operation: %1 = omp.groupprivate @any1 device_type (any) : !llvm.ptr
# | within split at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:4122 offset :12:8: warning: groupprivate directive is currently ignored on the host, using original global
# |   %4 = omp.groupprivate @host1 device_type(host) : !llvm.ptr
# |        ^
# | within split at /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:4122 offset :12:8: note: see current operation: %2 = omp.groupprivate @host1 device_type (host) : !llvm.ptr
# `-----------------------------
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:2006:12: error: CHECK: expected string not found in input
# |  // CHECK: store i32 %[[t1]], ptr %[[x_new:.*]]
# |            ^
# | <stdin>:7054:46: note: scanning from here
# |  %4 = call i32 @llvm.smax.i32(i32 %3, i32 %1)
# |                                              ^
# | <stdin>:7054:46: note: with "t1" equal to "4"
# |  %4 = call i32 @llvm.smax.i32(i32 %3, i32 %1)
# |                                              ^
# | <stdin>:7054:46: note: pattern attempts to capture variables: "x_new"
# |  %4 = call i32 @llvm.smax.i32(i32 %3, i32 %1)
# |                                              ^
# | <stdin>:7056:25: note: possible intended match here
# |  %6 = call i32 @llvm.umax.i32(i32 %5, i32 %1)
# |                         ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:2205:12: error: CHECK: expected string not found in input
# |  // CHECK: %[[xval:.*]] = phi i32
# |            ^
# | <stdin>:7221:23: note: scanning from here
# |  store i32 %48, ptr %1, align 4
# |                       ^
# | <stdin>:7221:23: note: pattern attempts to capture variables: "xval"
# |  store i32 %48, ptr %1, align 4
# |                       ^
# | <stdin>:7223:2: note: possible intended match here
# |  %54 = call i32 @llvm.smax.i32(i32 %53, i32 %2)
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir:2444:12: error: CHECK: expected string not found in input
# |  // CHECK: %[[xval:.*]] = phi i32
# |            ^
# | <stdin>:7378:23: note: scanning from here
# |  store i32 %47, ptr %1, align 4
# |                       ^
# | <stdin>:7378:23: note: pattern attempts to capture variables: "xval"
# |  store i32 %47, ptr %1, align 4
# |                       ^
# | <stdin>:7380:2: note: possible intended match here
# |  %54 = call i32 @llvm.smax.i32(i32 %53, i32 %2)
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/mlir/test/Target/LLVMIR/openmp-llvm.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |               .
# |               .
# |               .
# |            7049: define void @omp_atomic_update_intrinsic(ptr %0, i32 %1) { 
# |            7050:  br label %entry 
# |            7051:  
# |            7052: entry: ; preds = %2 
# |            7053:  %3 = atomicrmw max ptr %0, i32 %1 monotonic, align 4 
# |            7054:  %4 = call i32 @llvm.smax.i32(i32 %3, i32 %1) 
# | check:2006'0                                                 {   search range start (exclusive)
# | check:2006'1                                                     error: no match found in search range
# | check:2006'2                                                     with "t1" equal to "4"
# | check:2006'3                                                     pattern attempts to capture variables: "x_new"
# |            7055:  %5 = atomicrmw umax ptr %0, i32 %1 monotonic, align 4 
# |            7056:  %6 = call i32 @llvm.umax.i32(i32 %5, i32 %1) 
# | check:2006'4                             ?                       possible intended match
# |            7057:  ret void 
# |            7058: } 
# |            7059:  
# |            7060: ; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) 
# |            7061: declare i32 @llvm.smax.i32(i32, i32) #0 
# |               .
# |               .
# |               .
# |            7070: !0 = !{i32 2, !"Debug Info Version", i32 3} 
# |            7071:  
# |            7072: ; ModuleID = 'LLVMDialectModule' 
# |            7073: source_filename = "LLVMDialectModule" 
# |            7074:  
# |            7075: define void @atomic_update_cmpxchg(ptr %0, ptr %1) { 
# | check:2006'5                                       }                    search range end (exclusive)
# |            7076:  %x.new.val = alloca i32, align 4 
# |            7077:  %3 = load float, ptr %1, align 4 
# |            7078:  br label %entry 
# |            7079:  
# |            7080: entry: ; preds = %2 
# |               .
# |               .
# |               .
# |            7216:  %51 = extractvalue { i32, i1 } %50, 0 
# |            7217:  %52 = extractvalue { i32, i1 } %50, 1 
# |            7218:  br i1 %52, label %.atomic.exit18, label %.atomic.cont19 
# |            7219:  
# |            7220: .atomic.exit18: ; preds = %.atomic.cont19 
# |            7221:  store i32 %48, ptr %1, align 4 
# | check:2205'0                          {            search range start (exclusive)
# | check:2205'1                                       error: no match found in search range
# | check:2205'2                                       pattern attempts to capture variables: "xval"
# |            7222:  %53 = atomicrmw max ptr %0, i32 %2 monotonic, align 4 
# |            7223:  %54 = call i32 @llvm.smax.i32(i32 %53, i32 %2) 
# | check:2205'3      ?                                                possible intended match
# |            7224:  store i32 %54, ptr %1, align 4 
# |            7225:  %55 = atomicrmw min ptr %0, i32 %2 monotonic, align 4 
# |            7226:  %56 = call i32 @llvm.smin.i32(i32 %55, i32 %2) 
# |            7227:  store i32 %56, ptr %1, align 4 
# |            7228:  %57 = atomicrmw umax ptr %0, i32 %2 monotonic, align 4 
# |               .
# |               .
# |               .
# |            7259: !0 = !{i32 2, !"Debug Info Version", i32 3} 
# |            7260:  
# |            7261: ; ModuleID = 'LLVMDialectModule' 
# |            7262: source_filename = "LLVMDialectModule" 
# |            7263:  
# |            7264: define void @omp_atomic_capture_postfix_update(ptr %0, ptr %1, i32 %2, ptr %3, ptr %4, float %5) { 
# | check:2205'4                                                   }                                                      search range end (exclusive)
# |            7265:  %x.new.val20 = alloca i32, align 4 
# |            7266:  %x.new.val16 = alloca i32, align 4 
# |            7267:  %x.new.val12 = alloca i32, align 4 
# |            7268:  %x.new.val8 = alloca i32, align 4 
# |            7269:  %x.new.val4 = alloca i32, align 4 
# |               .
# |               .
# |               .
# |            7373:  %51 = extractvalue { i32, i1 } %50, 0 
# |            7374:  %52 = extractvalue { i32, i1 } %50, 1 
# |            7375:  br i1 %52, label %.atomic.exit18, label %.atomic.cont19 
# |            7376:  
# |            7377: .atomic.exit18: ; preds = %.atomic.cont19 
# |            7378:  store i32 %47, ptr %1, align 4 
# | check:2444'0                          {            search range start (exclusive)
# | check:2444'1                                       error: no match found in search range
# | check:2444'2                                       pattern attempts to capture variables: "xval"
# |            7379:  %53 = atomicrmw max ptr %0, i32 %2 monotonic, align 4 
# |            7380:  %54 = call i32 @llvm.smax.i32(i32 %53, i32 %2) 
# | check:2444'3      ?                                                possible intended match
# |            7381:  store i32 %53, ptr %1, align 4 
# |            7382:  %55 = atomicrmw min ptr %0, i32 %2 monotonic, align 4 
# |            7383:  %56 = call i32 @llvm.smin.i32(i32 %55, i32 %2) 
# |            7384:  store i32 %55, ptr %1, align 4 
# |            7385:  %57 = atomicrmw umax ptr %0, i32 %2 monotonic, align 4 
# |               .
# |               .
# |               .
# |            7421: %struct.ident_t = type { i32, i32, i32, i32, ptr } 
# |            7422:  
# |            7423: @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1 
# |            7424: @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8 
# |            7425:  
# |            7426: define void @omp_atomic_capture_misc(ptr %0, ptr %1, i32 %2, ptr %3, ptr %4, float %5) { 
# | check:2444'4                                         }                                                      search range end (exclusive)
# |            7427:  br label %entry 
# |            7428:  
# |            7429: entry: ; preds = %6 
# |            7430:  %7 = atomicrmw xchg ptr %0, i32 %2 monotonic, align 4 
# |            7431:  store i32 %7, ptr %1, align 4 
# |               .
# |               .
# |               .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/215654


More information about the flang-commits mailing list