Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b9d1f9c
Add comrg testing
kasaurov Mar 20, 2026
e5a0e8c
Introuduce libhipcxx patch to fix issue with CUDA tests
kasaurov Mar 20, 2026
423f015
Experimental: set -DTHEROCK_ENABLE_LLVM_TESTS=ON for compiler-runtime
kasaurov Mar 20, 2026
45ee86b
Update/Fix to follow the upstream changes of the vars
kasaurov Mar 20, 2026
67909fe
Fix for Windows buils
kasaurov Mar 21, 2026
bf463c7
Linux: fix build path name for comgr; Windows: add step to run unit t…
kasaurov Mar 21, 2026
fa8e90e
Add patch to fix lit tests path issue on Windows
kasaurov Mar 24, 2026
5f75674
Additional patch for comgr to address one failure in comgr lit tests
kasaurov Mar 24, 2026
e883b94
Additional Comgr patch for Windows
kasaurov Mar 24, 2026
26717f1
One more comgr patch
kasaurov Mar 24, 2026
32a3ac5
One more comgr patch
kasaurov Mar 25, 2026
2d94bef
Patch to exclude one lit test for Windows
kasaurov Mar 25, 2026
b1d3814
Update the patch to fix inconsistency between amd-mainline and comgr …
kasaurov Mar 25, 2026
e18ad21
Combine patches, which include one more congr patch
kasaurov Mar 25, 2026
2a9748e
Fix comgr patches following the upstream changes
kasaurov Mar 25, 2026
3e48ccc
Update comgr unit tests
kasaurov Mar 27, 2026
c22db77
Update patches to follow upstream changes
kasaurov Mar 31, 2026
96dc8a8
Fix issue with broken comgr lib for multi-arch builds
kasaurov Mar 31, 2026
6fdcbd5
Spliting build and run of Comgr tests to resolve issue with broken li…
kasaurov Apr 1, 2026
62e74e3
Fix for comgr library: attempt 2
kasaurov Apr 1, 2026
66d9723
Remove unnecessary -DBUILD_TESTING=ON
kasaurov Apr 1, 2026
38fd21a
Fix for Windows build
kasaurov Apr 1, 2026
9ff8a55
Fix for comgr library: attempt 4
kasaurov Apr 1, 2026
ed2c309
Fix for Math lib builds
kasaurov Apr 1, 2026
97a69a1
Geberal fix to set -DTHEROCK_BUILD_TESTING=OFF
kasaurov Apr 1, 2026
8f4be59
Remove general fix, but restrict the number of tools for comgr
kasaurov Apr 1, 2026
eeadd30
Fix for windows: set LLVM_TOOL_LLVM_DRIVER_BUILD OFF
kasaurov Apr 1, 2026
efdab8b
Fix CI logs to show size of artifacts
kasaurov Apr 1, 2026
2b3157a
One more experiment
kasaurov Apr 2, 2026
f129fcf
Experiment 10
kasaurov Apr 2, 2026
26692ee
Move Run Comgr tests step to the right place, add output for artifact…
kasaurov Apr 2, 2026
048b97b
Revert the changes related to artifact size, they don't work in any case
kasaurov Apr 2, 2026
b9c03a4
Merge branch 'main' into users/kasaurov/comg-unit-tests-01
kasaurov Apr 2, 2026
fb09304
Simplify the workflows
kasaurov Apr 2, 2026
a12d59a
Merge branch 'main' into users/kasaurov/comg-unit-tests-01
kasaurov Apr 2, 2026
f1e1f4c
Merge branch 'main' into users/kasaurov/comg-unit-tests-01
kasaurov Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build_portable_linux_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ jobs:
python build_tools/memory_monitor.py --phase Build -- \
cmake --build build --target therock-archives therock-dist -- -k 0

- name: Run comgr tests
continue-on-error: true
run: |
ctest --test-dir "${BUILD_DIR}/compiler/amd-comgr/build" --output-on-failure
"${BUILD_DIR}/compiler/amd-llvm/dist/lib/llvm/bin/llvm-lit" \
"${BUILD_DIR}/compiler/amd-comgr/build/test-lit" -v

- name: Test Packaging
if: ${{ github.event.repository.name == 'TheRock' }}
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build_windows_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ jobs:
python build_tools/memory_monitor.py --phase Build -- \
cmake --build "${{ env.BUILD_DIR }}" --target therock-archives therock-dist -- -k 0

- name: Run comgr tests
continue-on-error: true
run: |
ctest --test-dir "${{ env.BUILD_DIR }}/compiler/amd-comgr/build" --output-on-failure
"${{ env.BUILD_DIR }}/compiler/amd-llvm/dist/lib/llvm/bin/llvm-lit" \
"${{ env.BUILD_DIR }}/compiler/amd-comgr/build/test-lit" -v

- name: Report
if: ${{ !cancelled() }}
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ jobs:
python build_tools/memory_monitor.py --phase Build -- \
cmake --build "${BUILD_DIR}" --target stage-${STAGE_NAME} therock-artifacts -- -k 0

- name: Run comgr tests
if: ${{ inputs.stage_name == 'compiler-runtime' }}
continue-on-error: true
run: |
ctest --test-dir "${BUILD_DIR}/compiler/amd-comgr/build" --output-on-failure
"${BUILD_DIR}/compiler/amd-llvm/dist/lib/llvm/bin/llvm-lit" \
"${BUILD_DIR}/compiler/amd-comgr/build/test-lit" -v

- name: Report
if: ${{ !cancelled() }}
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/multi_arch_build_windows_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ jobs:
python build_tools/memory_monitor.py --phase Build -- \
cmake --build "${BUILD_DIR}" --target stage-${STAGE_NAME} therock-artifacts -- -k 0

- name: Run comgr tests
if: ${{ inputs.stage_name == 'compiler-runtime' }}
continue-on-error: true
run: |
ctest --test-dir "${{ env.BUILD_DIR }}/compiler/amd-comgr/build" --output-on-failure
"${{ env.BUILD_DIR }}/compiler/amd-llvm/dist/lib/llvm/bin/llvm-lit" \
"${{ env.BUILD_DIR }}/compiler/amd-comgr/build/test-lit" -v

- name: Report
if: ${{ !cancelled() }}
run: |
Expand Down
3 changes: 3 additions & 0 deletions build_tools/configure_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def generate_cmake_args(
for feature in sorted(features):
args.append(f"-DTHEROCK_ENABLE_{feature}=ON")

if stage_name == "compiler-runtime":
args.append("-DTHEROCK_BUILD_COMGR_TESTS=ON")

return args


Expand Down
3 changes: 2 additions & 1 deletion build_tools/github_actions/build_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def build_configure(build_dir, manylinux=False):
f"-DTHEROCK_PACKAGE_VERSION={package_version}",
f"-DCMAKE_C_COMPILER_LAUNCHER={c_launcher}",
f"-DCMAKE_CXX_COMPILER_LAUNCHER={cxx_launcher}",
"-DBUILD_TESTING=ON",
"-DTHEROCK_BUILD_TESTING=OFF",
"-DTHEROCK_BUILD_COMGR_TESTS=ON",
]
)

Expand Down
3 changes: 3 additions & 0 deletions cmake/therock_subproject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ set_property(GLOBAL PROPERTY THEROCK_DEFAULT_CMAKE_VARS
THEROCK_ROCM_SYSTEMS_SOURCE_DIR
THEROCK_BUILD_TESTING
THEROCK_ENABLE_LLVM_TESTS
THEROCK_BUILD_LLVM_TESTS
THEROCK_BUILD_LLVM_TOOLS
THEROCK_BUILD_COMGR_TESTS
LLVM_LIT_ARGS
THEROCK_USE_SAFE_DEPENDENCY_PROVIDER
ROCM_SYMLINK_LIBS
Expand Down
59 changes: 39 additions & 20 deletions compiler/pre_hook_amd-llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,65 @@ endif()

# Set the LLVM_ENABLE_PROJECTS variable before including LLVM's CMakeLists.txt
# Only enable BUILD_TESTING if LLVM tests are explicitly enabled
if(THEROCK_BUILD_LLVM_TESTS)
if(THEROCK_BUILD_LLVM_TESTS OR THEROCK_ENABLE_LLVM_TESTS)
set(BUILD_TESTING ON CACHE BOOL "Enable building LLVM tests" FORCE)
else()
set(BUILD_TESTING OFF CACHE BOOL "DISABLE BUILDING TESTS IN SUBPROJECTS" FORCE)
endif()

# Enable LLVM tools when tests are enabled (tests need the tools) or when explicitly requested
if(THEROCK_BUILD_LLVM_TESTS OR THEROCK_BUILD_LLVM_TOOLS OR THEROCK_BUILD_COMGR_TESTS)
if(THEROCK_BUILD_LLVM_TESTS OR THEROCK_BUILD_LLVM_TOOLS OR THEROCK_BUILD_COMGR_TESTS OR THEROCK_ENABLE_LLVM_TESTS)
set(LLVM_BUILD_TOOLS ON CACHE BOOL "Build LLVM tools required for tests" FORCE)
set(LLVM_INSTALL_UTILS ON CACHE BOOL "Install LLVM utility binaries like FileCheck" FORCE)

# Install llvm-lit script and the lit Python module for running LIT tests.
# LLVM_INSTALL_UTILS only installs C++ utilities (FileCheck, not, etc.),
# but llvm-lit is a Python script that requires separate handling.
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/bin/llvm-lit" DESTINATION bin)
# On Windows, LLVM generates llvm-lit.py (Python multiprocessing needs the
# .py suffix to find the main module) plus a llvm-lit.cmd batch wrapper.
# On Unix, it generates llvm-lit (no extension, with a shebang line).

# Install the lit Python module. This is needed for llvm-lit to function.
# We install it to a lib/python subdirectory and set PYTHONPATH in llvm-lit.
# Install the lit Python module so llvm-lit works outside the build tree
# (the build-tree script has a hardcoded source-tree path that won't exist
# after installation).
set(_lit_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/../llvm/utils/lit")
install(DIRECTORY "${_lit_source_dir}/lit"
DESTINATION "lib/python"
PATTERN "__pycache__" EXCLUDE
PATTERN "*.pyc" EXCLUDE
)

# Create a wrapper script that sets PYTHONPATH before invoking the real llvm-lit
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper" [=[#!/usr/bin/env bash
# Wrapper script for llvm-lit that sets up PYTHONPATH
if(WIN32)
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/bin/llvm-lit.py" DESTINATION bin)

# Create a .cmd wrapper that sets PYTHONPATH so the installed lit module
# is found, then delegates to the real llvm-lit.py script.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper.cmd" [=[@echo off
set "SCRIPT_DIR=%~dp0"
set "PYTHONPATH=%SCRIPT_DIR%..\lib\python;%PYTHONPATH%"
"%SCRIPT_DIR%llvm-lit.real.py" %*
exit /b %errorlevel%
]=])
install(CODE "
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit.py\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit.real.py\")
file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper.cmd\" DESTINATION \"\${CMAKE_INSTALL_PREFIX}/bin\")
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit-wrapper.cmd\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit.cmd\")
")
else()
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/bin/llvm-lit" DESTINATION bin)

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper" [=[#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
export PYTHONPATH="${SCRIPT_DIR}/../lib/python:${PYTHONPATH}"
exec "${SCRIPT_DIR}/llvm-lit.real" "$@"
]=])
# Install the wrapper and rename the original
install(CODE "
# Rename the original llvm-lit to llvm-lit.real
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit.real\" )
# Install the wrapper script as llvm-lit
file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper\" DESTINATION \"\${CMAKE_INSTALL_PREFIX}/bin\")
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit-wrapper\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\")
file(CHMOD \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
")
install(CODE "
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit.real\")
file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/llvm-lit-wrapper\" DESTINATION \"\${CMAKE_INSTALL_PREFIX}/bin\")
file(RENAME \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit-wrapper\" \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\")
file(CHMOD \"\${CMAKE_INSTALL_PREFIX}/bin/llvm-lit\" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
")
endif()
endif()
# we have never enabled benchmarks,
# disabling more explicitly after a bug fix enabled.
Expand Down Expand Up @@ -170,9 +188,10 @@ function(therock_set_implicit_llvm_options type tools_dir required_tool_names)
endforeach()
endfunction()

# When LLVM tests, tools, or Comgr tests are enabled, build all tools (don't selectively disable).
# Otherwise, only build the minimum required tools for production.
if(NOT THEROCK_BUILD_LLVM_TESTS AND NOT THEROCK_BUILD_LLVM_TOOLS AND NOT THEROCK_BUILD_COMGR_TESTS)
# When LLVM tests or tools are explicitly enabled, build all tools (don't selectively disable).
# Comgr tests only need the production tool set plus LLVM_INSTALL_UTILS (FileCheck, not, count),
# so they don't skip selective disabling -- the mega-driver is naturally disabled by the allow-list.
if(NOT THEROCK_BUILD_LLVM_TESTS AND NOT THEROCK_BUILD_LLVM_TOOLS AND NOT THEROCK_ENABLE_LLVM_TESTS)
block()
# This list contains the minimum tooling that must be enabled to build LLVM.
# It is empically derived (either configure or ninja invocation will fail
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
From 21dad863e00d44ba468713b3dc21bfc00e343406 Mon Sep 17 00:00:00 2001
From: Andrey Kasaurov <andrey.kasaurov@amd.com>
Date: Wed, 25 Mar 2026 12:00:08 -0400
Subject: [PATCH] [Comgr] Fix the issue with path names on Windows for lit
tests

Normalize paths to forward slashes in the comgr lit test
configuration so that tests work correctly on Windows (Git Bash).
Use find_program for llvm-lit discovery to handle platform-specific
extensions (.py, .cmd). Add the comgr library directory to PATH
so that amd_comgr.dll can be found at runtime on Windows.
---
amd/comgr/test-lit/CMakeLists.txt | 11 ++++++-----
amd/comgr/test-lit/lit.cfg.py | 25 ++++++++++++++++++-------
amd/comgr/test-lit/lit.site.cfg.py.in | 25 +++++++++++++++++++------
3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/amd/comgr/test-lit/CMakeLists.txt b/amd/comgr/test-lit/CMakeLists.txt
index bfc765e4a743..95f34a5ca8b8 100644
--- a/amd/comgr/test-lit/CMakeLists.txt
+++ b/amd/comgr/test-lit/CMakeLists.txt
@@ -11,11 +11,12 @@ cannonicalize_cmake_boolean(COMGR_DISABLE_SPIRV)
configure_file(lit.site.cfg.py.in lit.site.cfg.py @ONLY)

if (NOT DEFINED LLVM_LIT_PATH)
- # Comgr source build
- if (EXISTS "${LLVM_TOOLS_BINARY_DIR}/../../bin/llvm-lit")
- set(LLVM_LIT_PATH "${LLVM_TOOLS_BINARY_DIR}/../../bin/llvm-lit")
- # LLVM external projects build
- else()
+ find_program(LLVM_LIT_PATH
+ NAMES llvm-lit llvm-lit.py llvm-lit.cmd
+ PATHS "${LLVM_TOOLS_BINARY_DIR}/../../bin" "${LLVM_TOOLS_BINARY_DIR}"
+ NO_DEFAULT_PATH
+ )
+ if (NOT LLVM_LIT_PATH)
set(LLVM_LIT_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-lit")
endif()
endif()
diff --git a/amd/comgr/test-lit/lit.cfg.py b/amd/comgr/test-lit/lit.cfg.py
index 8f6392ff5958..c246aeba814e 100644
--- a/amd/comgr/test-lit/lit.cfg.py
+++ b/amd/comgr/test-lit/lit.cfg.py
@@ -1,7 +1,7 @@
import os
+import platform

import lit.formats
-import lit.util

config.name = "Comgr"
config.suffixes = {".hip", ".cl", ".c", ".cpp"}
@@ -15,13 +15,24 @@ config.test_exec_root = config.my_obj_root
if not config.comgr_disable_spirv:
config.available_features.add("comgr-has-spirv")

+if platform.system() == "Windows":
+ config.available_features.add("system-windows")
+elif platform.system() == "Linux":
+ config.available_features.add("system-linux")
+
# By default, disable the cache for the tests.
# Test for the cache must explicitly enable this variable.
config.environment['AMD_COMGR_CACHE'] = "0"

-# Add substitutions for LLVM tools
-config.substitutions.append(('%clang', os.path.join(config.llvm_tools_dir, 'clang')))
-config.substitutions.append(('%llvm-dis', os.path.join(config.llvm_tools_dir, 'llvm-dis')))
-config.substitutions.append(('%llvm-objdump', os.path.join(config.llvm_tools_dir, 'llvm-objdump')))
-config.substitutions.append(('%FileCheck', os.path.join(config.llvm_tools_dir, 'FileCheck')))
-config.substitutions.append(('%amd-llvm-spirv', os.path.join(config.llvm_tools_dir, 'amd-llvm-spirv')))
+# Resolve tool paths at configure time with forward slashes. On Windows,
+# os.path.join may return paths with backslashes, which break when written
+# into bash scripts (e.g. "bin\clang" -> "binclang").
+def _fwd(*parts):
+ return os.path.join(*parts).replace("\\", "/")
+
+# %-prefixed substitutions for LLVM tools (used as %clang, %llvm-dis, etc.)
+config.substitutions.append(('%clang', _fwd(config.llvm_tools_dir, 'clang')))
+config.substitutions.append(('%llvm-dis', _fwd(config.llvm_tools_dir, 'llvm-dis')))
+config.substitutions.append(('%llvm-objdump', _fwd(config.llvm_tools_dir, 'llvm-objdump')))
+config.substitutions.append(('%FileCheck', _fwd(config.llvm_tools_dir, 'FileCheck')))
+config.substitutions.append(('%amd-llvm-spirv', _fwd(config.llvm_tools_dir, 'amd-llvm-spirv')))
diff --git a/amd/comgr/test-lit/lit.site.cfg.py.in b/amd/comgr/test-lit/lit.site.cfg.py.in
index 30395d720039..cb9bebba7d7e 100644
--- a/amd/comgr/test-lit/lit.site.cfg.py.in
+++ b/amd/comgr/test-lit/lit.site.cfg.py.in
@@ -1,16 +1,29 @@
import os

-config.my_src_root = r'@CMAKE_CURRENT_SOURCE_DIR@'
-config.my_obj_root = r'@CMAKE_CURRENT_BINARY_DIR@'
+def _fwd(p):
+ """Normalize path to forward slashes so it is safe in bash scripts."""
+ return p.replace("\\", "/")
+
+config.my_src_root = _fwd(r'@CMAKE_CURRENT_SOURCE_DIR@')
+config.my_obj_root = _fwd(r'@CMAKE_CURRENT_BINARY_DIR@')

config.comgr_disable_spirv = @COMGR_DISABLE_SPIRV@

-# Needed for Comgr binaries
-config.environment['PATH'] = os.pathsep.join(["@CMAKE_CURRENT_BINARY_DIR@",
+config.llvm_tools_dir = _fwd(r'@LLVM_TOOLS_BINARY_DIR@')
+config.comgr_obj_dir = config.my_obj_root
+config.comgr_lib_dir = _fwd(os.path.dirname(config.my_obj_root))
+
+# Needed for clang, llvm-dis, etc.
+config.environment['PATH'] = os.pathsep.join([config.llvm_tools_dir,
config.environment['PATH']])

-# Set path to LLVM tools for substitutions
-config.llvm_tools_dir = r'@LLVM_TOOLS_BINARY_DIR@'
+# Needed for amd_comgr shared library (DLL on Windows)
+config.environment['PATH'] = os.pathsep.join([config.comgr_lib_dir,
+ config.environment['PATH']])
+
+# Needed for Comgr test binaries
+config.environment['PATH'] = os.pathsep.join([config.comgr_obj_dir,
+ config.environment['PATH']])

lit_config.load_config(
config, os.path.join(config.my_src_root, "lit.cfg.py"))
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From 2bb3ec52606a9ebd16c5751c3ec38fc500824dfc Mon Sep 17 00:00:00 2001
From: Andrey Kasaurov <andrey.kasaurov@amd.com>
Date: Tue, 31 Mar 2026 02:44:54 -0400
Subject: [PATCH] Fix cache test for Windows and ctest wchar_size linking

- Use cross-platform FileCheck regex in compile-minimal-cached-bad-dir.cl
to match both Linux ("Not a directory") and Windows ("no such file or
directory") error messages.
- Add -fshort-wchar flag when compiling test input bitcodes on Windows
to match device-libs and avoid conflicting wchar_size module flags.
---
.../cache-tests/compile-minimal-cached-bad-dir.cl | 7 +++++--
amd/comgr/test/CMakeLists.txt | 9 +++++++++
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/amd/comgr/test-lit/cache-tests/compile-minimal-cached-bad-dir.cl b/amd/comgr/test-lit/cache-tests/compile-minimal-cached-bad-dir.cl
index aff955b02f98..512d167c8c43 100644
--- a/amd/comgr/test-lit/cache-tests/compile-minimal-cached-bad-dir.cl
+++ b/amd/comgr/test-lit/cache-tests/compile-minimal-cached-bad-dir.cl
@@ -9,5 +9,8 @@
// RUN: compile-opencl-minimal %S/../compile-minimal.cl %t.bin 1.2
// RUN: %llvm-objdump -d %t.bin | %FileCheck %S/../compile-minimal.cl
// RUN: %FileCheck --check-prefix=BAD %s < %t.log
-// BAD: Failed to open cache file
-// BAD-SAME: Not a directory
+// COM: The error message differs by platform:
+// COM: Linux: Comgr cache, when building the add stream callback: Failed to open cache file <path>: Not a directory
+// COM: Windows: Comgr cache, when getting the cached file stream: no such file or directory: AMDGPUCompilerCache: Can't get a temporary file
+// BAD: Comgr cache,
+// BAD-SAME: {{Not a directory|no such file or directory}}
diff --git a/amd/comgr/test/CMakeLists.txt b/amd/comgr/test/CMakeLists.txt
index f4d05005bae5..f21b9899ed71 100644
--- a/amd/comgr/test/CMakeLists.txt
+++ b/amd/comgr/test/CMakeLists.txt
@@ -23,11 +23,20 @@ endmacro()
# Creates target ${name} which depends on a clang command to compile ${input} to
# ${output}, with any additional arguments from ${ARGN}, and add it to the
# TEST_INPUT_BITCODES target list.
+set(TEST_INPUT_WCHAR_FLAG)
+if(WIN32)
+ # Match -fshort-wchar used by device libs on Windows (see
+ # amd/device-libs/cmake/OCL.cmake). Without this, linking fails with
+ # conflicting wchar_size module flags.
+ set(TEST_INPUT_WCHAR_FLAG -fshort-wchar)
+endif()
+
macro(add_test_input_bitcode name input output)
add_custom_command(
OUTPUT "${output}"
COMMAND "$<TARGET_FILE:clang>" -c -emit-llvm -target amdgcn-amd-amdhsa
-mcpu=gfx900 -nogpulib -nogpuinc
+ ${TEST_INPUT_WCHAR_FLAG}
${ARGN} "${CMAKE_CURRENT_SOURCE_DIR}/${input}"
-o "${output}"
VERBATIM
--
2.34.1

Loading