[clang] [clang-tools-extra] [compiler-rt] [flang] [lldb] [llvm] [mlir] [openmp] [AMDGPU] Enable expensive unroll trip count. (PR #165476)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 13:54:02 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD amd/comgr/cmake/device-libs-id.py amd/comgr/test-lit/lit.cfg.py amd/hipcc/docs/conf.py compiler-rt/test/asan/TestCases/AMDGPU/lit.local.cfg.py openmp/libompd/gdb-plugin/loadompd.py openmp/libompd/gdb-plugin/setup.py clang-tools-extra/docs/conf.py clang/docs/conf.py clang/test/lit.cfg.py compiler-rt/test/asan/lit.cfg.py openmp/docs/conf.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- amd/comgr/cmake/device-libs-id.py	2025-10-28 20:46:37.000000 +0000
+++ amd/comgr/cmake/device-libs-id.py	2025-10-28 20:51:49.856724 +0000
@@ -5,22 +5,35 @@
 from argparse import ArgumentParser
 from hashlib import sha256
 from os.path import join as join_path
 
 if __name__ == "__main__":
-    parser = ArgumentParser(description='Generate id by computing a hash of the generated headers')
-    parser.add_argument("headers", nargs='+', help='List of headers to generate id from')
+    parser = ArgumentParser(
+        description="Generate id by computing a hash of the generated headers"
+    )
+    parser.add_argument(
+        "headers", nargs="+", help="List of headers to generate id from"
+    )
     # On Windows, we cannot list the realpath for every individual header since we hit cmd.exe's
     # maximum command line lenght. As a workaround, we pass the pwd and the headers separately.
-    parser.add_argument("--parent-directory", help='Parent directory for the headers', required=True)
-    parser.add_argument("--varname", help='Name of the variable to generate', required=True)
-    parser.add_argument("--output", help='Name of the header to generate', required=True)
+    parser.add_argument(
+        "--parent-directory", help="Parent directory for the headers", required=True
+    )
+    parser.add_argument(
+        "--varname", help="Name of the variable to generate", required=True
+    )
+    parser.add_argument(
+        "--output", help="Name of the header to generate", required=True
+    )
 
     args = parser.parse_args()
     args.headers.sort()
-    
+
     hash = sha256()
     for header in args.headers:
-        hash.update(open(join_path(args.parent_directory, header), 'rb').read())
+        hash.update(open(join_path(args.parent_directory, header), "rb").read())
     digest_uchar = hash.digest()
     digest_elts = ", ".join(map(str, digest_uchar))
-    print(f"static const unsigned char {args.varname}[] = {{{digest_elts}, 0}};", file=open(args.output, 'w'))
+    print(
+        f"static const unsigned char {args.varname}[] = {{{digest_elts}, 0}};",
+        file=open(args.output, "w"),
+    )
--- amd/comgr/test-lit/lit.cfg.py	2025-10-28 20:46:37.000000 +0000
+++ amd/comgr/test-lit/lit.cfg.py	2025-10-28 20:51:49.867525 +0000
@@ -15,6 +15,6 @@
 if not config.comgr_disable_spirv:
     config.available_features.add("comgr-has-spirv")
 
 # By default, disable the cache for the tests.
 # Test for the cache must explicitly enable this variable.
-config.environment['AMD_COMGR_CACHE'] = "0"
+config.environment["AMD_COMGR_CACHE"] = "0"
--- amd/hipcc/docs/conf.py	2025-10-28 20:46:37.000000 +0000
+++ amd/hipcc/docs/conf.py	2025-10-28 20:51:49.879653 +0000
@@ -6,12 +6,12 @@
 
 import re
 
 from rocm_docs import ROCmDocs
 
-with open('../CMakeLists.txt', encoding='utf-8') as f:
-    match = re.search(r'.*\bproject\(hipcc VERSION\s+\"?([0-9.]+)[^0-9.]+', f.read())
+with open("../CMakeLists.txt", encoding="utf-8") as f:
+    match = re.search(r".*\bproject\(hipcc VERSION\s+\"?([0-9.]+)[^0-9.]+", f.read())
     if not match:
         raise ValueError("VERSION not found!")
     version_number = match[1]
 left_nav_title = f"HIPCC {version_number} Documentation"
 
--- clang/docs/conf.py	2025-10-28 20:46:37.000000 +0000
+++ clang/docs/conf.py	2025-10-28 20:51:49.942315 +0000
@@ -87,11 +87,11 @@
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = "friendly"
 
 # A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
 
 #  TODO: Temporary workaround for configuration error to get man pages built
 
 # in_progress_title = "(In-Progress) " if tags.has("PreRelease") else ""
 
--- compiler-rt/test/asan/TestCases/AMDGPU/lit.local.cfg.py	2025-10-28 20:46:37.000000 +0000
+++ compiler-rt/test/asan/TestCases/AMDGPU/lit.local.cfg.py	2025-10-28 20:51:50.082810 +0000
@@ -1,13 +1,14 @@
 def getRoot(config):
-  if not config.parent:
-    return config
-  return getRoot(config.parent)
+    if not config.parent:
+        return config
+    return getRoot(config.parent)
+
 
 root = getRoot(config)
 
-if root.host_os not in ['Linux']:
-  config.unsupported = True
-if root.target_arch not in ['x86_64']:
-  config.unsupported = True
-if root.support_amd_offload_tests == 'false':
-  config.unsupported = True
+if root.host_os not in ["Linux"]:
+    config.unsupported = True
+if root.target_arch not in ["x86_64"]:
+    config.unsupported = True
+if root.support_amd_offload_tests == "false":
+    config.unsupported = True
--- compiler-rt/test/asan/lit.cfg.py	2025-10-28 20:46:37.000000 +0000
+++ compiler-rt/test/asan/lit.cfg.py	2025-10-28 20:51:50.222043 +0000
@@ -330,47 +330,63 @@
     config.parallelism_group = "shadow-memory"
 
 if config.target_os == "NetBSD":
     config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))
 
+
 # Find ROCM runtime and compiler paths only
 # when built with -DSANITIZER_AMDGPU=1
 def configure_rocm(config, test_rocm_path):
-    if (not os.path.isdir(test_rocm_path)):
+    if not os.path.isdir(test_rocm_path):
         print("no directory found")
-        test_rocm_path = os.path.join('/opt','rocm')
-        if (not os.path.isdir(test_rocm_path)):
-            test_rocm_path = os.path.abspath(os.path.join(config.llvm_install_dir, os.pardir))
-            if (not os.path.isdir(test_rocm_path)):
-                sys.exit("ROCM installation not found, try exporting ASAN_TEST_ROCM variable")
-
-    test_device_libs  = os.path.join(test_rocm_path, 'amdgcn', 'bitcode')
-    test_hip_path     = os.path.join(test_rocm_path, 'hip')
-    hipcc             = os.path.join(test_hip_path, 'bin', 'hipcc')
-
-    build_clang = getattr(config, 'clang', None)
+        test_rocm_path = os.path.join("/opt", "rocm")
+        if not os.path.isdir(test_rocm_path):
+            test_rocm_path = os.path.abspath(
+                os.path.join(config.llvm_install_dir, os.pardir)
+            )
+            if not os.path.isdir(test_rocm_path):
+                sys.exit(
+                    "ROCM installation not found, try exporting ASAN_TEST_ROCM variable"
+                )
+
+    test_device_libs = os.path.join(test_rocm_path, "amdgcn", "bitcode")
+    test_hip_path = os.path.join(test_rocm_path, "hip")
+    hipcc = os.path.join(test_hip_path, "bin", "hipcc")
+
+    build_clang = getattr(config, "clang", None)
     build_clang = build_clang.lstrip()
     build_clang = build_clang.rstrip()
     test_clang_path = os.path.dirname(build_clang)
 
     def hip_build_invocation(hipcc, compile_flags):
-        return ' ' + ' '.join([hipcc] + compile_flags) + ' ' # append extra space to avoid concat issue in shell
+        return (
+            " " + " ".join([hipcc] + compile_flags) + " "
+        )  # append extra space to avoid concat issue in shell
 
     hipcxx_sanitize_options = ["-fsanitize=address", "-shared-libsan", "-fgpu-sanitize"]
 
     config.substitutions.append(
-        ('%hipcompiler',
-        hip_build_invocation(hipcc, config.cxx_mode_flags + [config.target_cflags] + hipcxx_sanitize_options)))
-
-    #ROCM SPECIFIC ENVIRONMENT VARIABLES
-    device_library_path    = 'DEVICE_LIB_PATH=' + test_device_libs
-    hip_path               = 'HIP_PATH='        + test_hip_path
-    rocm_path              = 'ROCM_PATH='       + test_rocm_path
-    clang_path             = 'HIP_CLANG_PATH='  + test_clang_path
-    rocm_environment       = [device_library_path, hip_path, rocm_path, clang_path]
-    export_rocm_components = 'export ' + ' '.join(rocm_environment)
-    config.substitutions.append(('%ROCM_ENV', export_rocm_components))
-    config.suffixes.append('.hip')
-
-test_rocm_path = os.environ.get('ASAN_TEST_ROCM','null')
-if config.support_amd_offload_tests == 'true':
+        (
+            "%hipcompiler",
+            hip_build_invocation(
+                hipcc,
+                config.cxx_mode_flags
+                + [config.target_cflags]
+                + hipcxx_sanitize_options,
+            ),
+        )
+    )
+
+    # ROCM SPECIFIC ENVIRONMENT VARIABLES
+    device_library_path = "DEVICE_LIB_PATH=" + test_device_libs
+    hip_path = "HIP_PATH=" + test_hip_path
+    rocm_path = "ROCM_PATH=" + test_rocm_path
+    clang_path = "HIP_CLANG_PATH=" + test_clang_path
+    rocm_environment = [device_library_path, hip_path, rocm_path, clang_path]
+    export_rocm_components = "export " + " ".join(rocm_environment)
+    config.substitutions.append(("%ROCM_ENV", export_rocm_components))
+    config.suffixes.append(".hip")
+
+
+test_rocm_path = os.environ.get("ASAN_TEST_ROCM", "null")
+if config.support_amd_offload_tests == "true":
     configure_rocm(config, test_rocm_path)
--- openmp/libompd/gdb-plugin/loadompd.py	2025-10-28 20:46:37.000000 +0000
+++ openmp/libompd/gdb-plugin/loadompd.py	2025-10-28 20:51:50.256684 +0000
@@ -7,9 +7,9 @@
         sys.path.append(os.path.dirname(__file__))
 
         from ompd import ompd
 
         ompd.main()
-        print('OMPD GDB support loaded')
+        print("OMPD GDB support loaded")
     except Exception as e:
         traceback.print_exc()
-        print('Error: OMPD support could not be loaded', e)
+        print("Error: OMPD support could not be loaded", e)
--- openmp/libompd/gdb-plugin/setup.py	2025-10-28 20:46:37.000000 +0000
+++ openmp/libompd/gdb-plugin/setup.py	2025-10-28 20:51:50.272155 +0000
@@ -1,22 +1,35 @@
 from setuptools import setup, Extension, find_packages
 
-import os 
+import os
 
 dir_path = os.path.dirname(os.path.realpath(__file__))
-omp_include_dir = os.environ.get('LIBOMP_INCLUDE_DIR', dir_path)
-llvm_include_dir = os.environ.get('LLVM_MAIN_INCLUDE_DIR', dir_path)
-python_include_dir = os.environ.get('PYTHON_HEADERS', dir_path)
+omp_include_dir = os.environ.get("LIBOMP_INCLUDE_DIR", dir_path)
+llvm_include_dir = os.environ.get("LLVM_MAIN_INCLUDE_DIR", dir_path)
+python_include_dir = os.environ.get("PYTHON_HEADERS", dir_path)
 
 # Needed for dlsym
-clang_cpp = os.environ.get('CLANG_CPP', dir_path)
-clang_cpp_dir = clang_cpp.split('libclang-cpp.so')
+clang_cpp = os.environ.get("CLANG_CPP", dir_path)
+clang_cpp_dir = clang_cpp.split("libclang-cpp.so")
 
 print("find_packages : ", find_packages())
 setup(
-    name='ompd',
-    version='1.0',
-    py_modules=['loadompd'],
-    setup_requires=['wheel'],
+    name="ompd",
+    version="1.0",
+    py_modules=["loadompd"],
+    setup_requires=["wheel"],
     packages=find_packages(),
-    ext_modules=[Extension('ompd.ompdModule', [dir_path+'/ompdModule.c', dir_path+'/ompdAPITests.c', dir_path+'/DLSymService.cpp'], include_dirs=[omp_include_dir, llvm_include_dir], runtime_library_dirs=["$ORIGIN:$ORIGIN/../lib"], libraries=['clang-cpp'], library_dirs=[clang_cpp_dir[0]])]
+    ext_modules=[
+        Extension(
+            "ompd.ompdModule",
+            [
+                dir_path + "/ompdModule.c",
+                dir_path + "/ompdAPITests.c",
+                dir_path + "/DLSymService.cpp",
+            ],
+            include_dirs=[omp_include_dir, llvm_include_dir],
+            runtime_library_dirs=["$ORIGIN:$ORIGIN/../lib"],
+            libraries=["clang-cpp"],
+            library_dirs=[clang_cpp_dir[0]],
+        )
+    ],
 )

``````````

</details>


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


More information about the llvm-commits mailing list