[llvm] [Offload] Move (most) global state to an `OffloadContext` struct (PR #144494)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 21 04:39:48 PDT 2025


mgorny wrote:

This seems to have introduced a test regression for me. 9fd22cb56d4c626769afd938e0f9ef6157164394 is passing tests, but with 53336ad488c953d41e744d42873d712276be980f and later I'm getting test failures.

The result with main as of 77941eba7f01fc6576b3e060a3fb9cad1a64f9ea is:

```
FAIL: libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/entry_points.td (314 of 716)
******************** TEST 'libomptarget :: x86_64-unknown-linux-gnu :: tools/offload-tblgen/entry_points.td' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td | /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# .---command stderr------------
# | /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td:28:11: error: CHECK: expected string not found in input
# | // CHECK: if (offloadConfig().TracingEnabled) {
# |           ^
# | <stdin>:22:47: note: scanning from here
# | OL_APIEXPORT ol_result_t OL_APICALL FunctionA(
# |                                               ^
# | <stdin>:24:72: note: possible intended match here
# | if (!llvm::offload::isOffloadInitialized()) return &UninitError; if (llvm::offload::isTracingEnabled()) {
# |                                                                        ^
# | 
# | Input file: <stdin>
# | Check file: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            17:  } 
# |            18:  
# |            19:  return llvm::offload::FunctionA_impl(ParamA, ParamB); 
# |            20:  
# |            21: } 
# |            22: OL_APIEXPORT ol_result_t OL_APICALL FunctionA( 
# | check:28'0                                                   X error: no match found
# |            23:  uint32_t ParamA, uint32_t* ParamB) { 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            24: if (!llvm::offload::isOffloadInitialized()) return &UninitError; if (llvm::offload::isTracingEnabled()) { 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:28'1                                                                            ?                                   possible intended match
# |            25:  llvm::errs() << "---> FunctionA"; 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            26:  } 
# | check:28'0     ~~~
# |            27:  
# | check:28'0     ~
# |            28:  ol_result_t Result = llvmErrorToOffloadError(FunctionA_val(ParamA, ParamB)); 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            29:  
# | check:28'0     ~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
FAIL: libomptarget :: x86_64-unknown-linux-gnu-LTO :: tools/offload-tblgen/entry_points.td (673 of 716)
******************** TEST 'libomptarget :: x86_64-unknown-linux-gnu-LTO :: tools/offload-tblgen/entry_points.td' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td | /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload_build/offload-tblgen -gen-entry-points -I /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/../../../liboffload/API /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# executed command: /usr/lib/llvm/21/bin/FileCheck /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# .---command stderr------------
# | /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td:28:11: error: CHECK: expected string not found in input
# | // CHECK: if (offloadConfig().TracingEnabled) {
# |           ^
# | <stdin>:22:47: note: scanning from here
# | OL_APIEXPORT ol_result_t OL_APICALL FunctionA(
# |                                               ^
# | <stdin>:24:72: note: possible intended match here
# | if (!llvm::offload::isOffloadInitialized()) return &UninitError; if (llvm::offload::isTracingEnabled()) {
# |                                                                        ^
# | 
# | Input file: <stdin>
# | Check file: /var/tmp/portage/llvm-runtimes/offload-21.0.0.9999/work/offload/test/tools/offload-tblgen/entry_points.td
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            17:  } 
# |            18:  
# |            19:  return llvm::offload::FunctionA_impl(ParamA, ParamB); 
# |            20:  
# |            21: } 
# |            22: OL_APIEXPORT ol_result_t OL_APICALL FunctionA( 
# | check:28'0                                                   X error: no match found
# |            23:  uint32_t ParamA, uint32_t* ParamB) { 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            24: if (!llvm::offload::isOffloadInitialized()) return &UninitError; if (llvm::offload::isTracingEnabled()) { 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:28'1                                                                            ?                                   possible intended match
# |            25:  llvm::errs() << "---> FunctionA"; 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            26:  } 
# | check:28'0     ~~~
# |            27:  
# | check:28'0     ~
# |            28:  ol_result_t Result = llvmErrorToOffloadError(FunctionA_val(ParamA, ParamB)); 
# | check:28'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            29:  
# | check:28'0     ~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
```

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


More information about the llvm-commits mailing list