[libc-commits] [libc] [libc] Increase stack size in NVPTX matcher stress test (PR #244276)

via libc-commits libc-commits at lists.llvm.org
Thu Nov 19 08:46:59 PST 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Caroline Rodewig (carodewig)

<details>
<summary>Changes</summary>

Since #<!-- -->236569 landed, I've been seeing a GPU memory-access error while running `matcher_test` (buildbot error [here](https://lab.llvm.org/buildbot/#/builders/101/builds/47542)). The new long-pattern cases exceed the test runner’s default 3 KiB device stack.

This PR lets test-specific `ENV` entries override `LIBOMPTARGET_STACK_SIZE` and gives `matcher_test` a 64 KiB stack to prevent overflow.

Verified on a local GPU: the original 3 KiB setting reproduces the memory-access error, while 64 KiB passes all 13 matcher tests.

Assisted-by: Devin

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


2 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCTestRules.cmake (+5-4) 
- (modified) libc/test/src/__support/regex/CMakeLists.txt (+4) 


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 222d3477fe500f..8dc737028afad1 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -617,11 +617,12 @@ function(_add_libc_test_runner fq_target_name fq_build_target_name test_args loa
     string(REPLACE "@BINARY@" "${test_binary}" test_cmd_parsed ${LIBC_TEST_CMD})
     string(REPLACE " " ";" test_cmd "${test_cmd_parsed}")
   else()
-    set(test_cmd ${test_env})
+    set(test_cmd)
     if(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
       list(APPEND test_cmd "LIBOMPTARGET_STACK_SIZE=3072")
     endif()
     list(APPEND test_cmd
+      ${test_env}
       ${CMAKE_CROSSCOMPILING_EMULATOR} ${loader_args}
       "${test_binary}" ${test_args})
   endif()
@@ -636,12 +637,12 @@ function(_add_libc_test_runner fq_target_name fq_build_target_name test_args loa
       string(APPEND _params_content "${_arg}\n")
     endforeach()
     string(APPEND _params_content "---\n")
-    foreach(_env_entry IN LISTS test_env)
-      string(APPEND _params_content "${_env_entry}\n")
-    endforeach()
     if(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
       string(APPEND _params_content "LIBOMPTARGET_STACK_SIZE=3072\n")
     endif()
+    foreach(_env_entry IN LISTS test_env)
+      string(APPEND _params_content "${_env_entry}\n")
+    endforeach()
 
     file(GENERATE
       OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${fq_build_target_name}.params"
diff --git a/libc/test/src/__support/regex/CMakeLists.txt b/libc/test/src/__support/regex/CMakeLists.txt
index 156b99c761901c..31e842adc4e5e4 100644
--- a/libc/test/src/__support/regex/CMakeLists.txt
+++ b/libc/test/src/__support/regex/CMakeLists.txt
@@ -11,6 +11,10 @@ add_libc_test(
 
 add_libc_test(
   matcher_test
+  # The long grouped-repeat and RFC grammar cases need more than the default
+  # 3 KiB device stack for recursive parsing and derivative evaluation.
+  ENV
+    LIBOMPTARGET_STACK_SIZE=65536
   SUITE
     libc-support-tests
   SRCS

``````````

</details>


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


More information about the libc-commits mailing list