Skip to content

[comgr] enable multithreaded test#199216

Closed
accauble wants to merge 10000 commits into
llvm:mainfrom
ROCm:users/accauble/comgr-enable-multithreaded-test
Closed

[comgr] enable multithreaded test#199216
accauble wants to merge 10000 commits into
llvm:mainfrom
ROCm:users/accauble/comgr-enable-multithreaded-test

Conversation

@accauble
Copy link
Copy Markdown
Contributor

Re-enable comgr's multithreaded test

A one-line change to re-enable the multithreaded test in comgr which had been commented out because it would break with ASAN builds. The break was a bug in ASAN which has now been patched upstream.

Testing

Build ASAN in LLVM (-DCOMPILER_RT_BUILD_SANITIZERS=ON). Build comgr with and without ASAN (-DADDRESS_SANITIZER=On). The tests pass in both builds.

z1-cciauto and others added 30 commits May 3, 2026 01:29
changes for comgr:
 amd/comgr/src/comgr-compiler.cpp
 amd/comgr/src/comgr-disassembly.cpp
 amd/comgr/src/comgr-hotswap-llvm.cpp

2 lit tests xfailed:
jacob   llvm/test/Bitcode/DILocalVariable-address-space.ll
krishna mlir/test/Dialect/OpenMP/invalid.mlir
## Summary

Bump Comgr version to 3.2 to match the hotswap public API
(`amd_comgr_hotswap_rewrite`) that already shipped on `amd-staging`.

## Background

- The hotswap rewrite API is tagged `AMD_COMGR_VERSION_3_2` in
  `amd/comgr/include/amd_comgr.h.in`.
- `amd/comgr/src/exportmap.in` already exposes
  `amd_comgr_hotswap_rewrite` under the `amd_comgr_3.2` symbol
  version.
- `amd/comgr/VERSION.txt` was never bumped past 3.0, so every
  nightly was producing `libamd_comgr.so.3.0.0` despite the
  >3.0 API surface.
- `amd/comgr/src/amdcomgr.def` (Windows DLL exports) was missing
  `amd_comgr_hotswap_rewrite`, so the symbol was not exported on
  Windows builds.

## Changes

- `amd/comgr/VERSION.txt`: `MINOR 0 → 2`
- `amd/comgr/src/amdcomgr.def`: add `amd_comgr_hotswap_rewrite`

## ABI impact

`SOVERSION` is `MAJOR`-only (`libamd_comgr.so.3`), so this bump
is ABI-compatible — no consumer relinking required. The full
versioned filename changes from `libamd_comgr.so.3.0.0` to
`libamd_comgr.so.3.2.0`.

---------

Co-authored-by: Claude <noreply@anthropic.com>
…th (#2386)

## Summary

When HIP code is compiled to SPIR-V through COMGR (e.g. via hipRTC), the
HIPAMD
clang driver invokes `llvm-spirv` with flags like
`--spirv-ext=+all,-SPV_KHR_untyped_pointers`. COMGR intercepts the
command and
runs it in-process via `writeSpirv`, but `executeSPIRVTranslator` only
scanned
`Args` for the input/output filenames and built `SPIRV::TranslatorOpts`
from
scratch with `enableAllExtensions()` — re-enabling
`SPV_KHR_untyped_pointers`
after the driver explicitly disabled it, producing SPIR-V with untyped
pointers
and breaking downstream BC link.

This PR parses the `--spirv-*` subset emitted by HIPAMD (max-version,
ext map
with `+all`/`-EXT` semantics, debug-info-version,
allow-unknown-intrinsics,
preserve-auxdata) and configures `TranslatorOpts` to match, so the
in-process
path behaves like the standalone `amd-llvm-spirv` tool.

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
## Motivation

`amd/comgr/test-unit/CMakeLists.txt` discovers gtest from two places,
both coupling Comgr's tests to the LLVM build: the in-tree `llvm_gtest`
target, or an LLVM install built with `-DLLVM_INSTALL_GTEST=ON`.

In TheRock superproject builds, `amd-llvm` is built without
`LLVM_INSTALL_GTEST` (see ROCm/TheRock#4627), but TheRock ships a
first-class `therock-googletest` subproject exposing the standard
`GTest::` imported targets via `find_package(GTest)`. With the current
logic, test-unit silently `return()`s with a warning.

## Technical Details

Insert a middle tier into the discovery ladder:

1. `TARGET llvm_gtest` — unchanged.
2. **`find_package(GTest CONFIG QUIET)`** — new. Picks up vanilla
   googletest from superproject builds.
3. LLVM-installed `llvm_gtest` via `find_library` — unchanged.

`comgr_match_llvm_rtti()` is unchanged; it still gates on
`LLVM_ENABLE_RTTI` regardless of gtest source.

## Test Plan

- LLVM monorepo build: still hits the `llvm_gtest` branch.
- `-DLLVM_INSTALL_GTEST=ON` install: still hits the legacy fallback.
- TheRock with `BUILD_DEPS therock-googletest` on `amd-comgr`: now
  builds via the new `find_package(GTest)` branch.

Co-authored-by: Claude <noreply@anthropic.com>
ECTrans fixes:
- Emit attach maps for use_device_*
- Move attach maps to always be inserted into the map clause, regardless of
  which clause the main map is from
- Remove optimization of skipping emission of unrequired attach maps, causes
  symmetry issues with stack size and breaks ectrans which depends on the
  stack layout being precise due to sketchy map choices

ICON fixes:
- Now that OpenMP has the attach map style, it's possible for pointer maps to
  bypass the size 0 check that PTR_AND_OBJ does before sending out data
  submits. This PR tries to add a size 0 barrier from submitting data to device
  for target update cases, the enter/exit map scenarios and regular target take
  different paths that already avoid this scenario. The size 0 submission is
  bad for multi-SDMA engine devices as we disallow these types of mappings and
  return an error in these cases. So, we need to avoid the submission to the
  plugin in the first place without impacting any ref counting or other runtime
  book keeping.
…2359)

A predicate guarding a builtin with no required features is encoded as
`@llvm.amdgcn.has.` with an empty suffix which is not handled properly

Fixes ROCM-23825

---------

Co-authored-by: Jacob Lambert <jacob.lambert@amd.com>
… -- DS Instructions (#2369)

Implements the `ds_*_2addr_stride64_*` trampoline patch for the GFX1250
B0-to-A0 HotSwap pipeline. This B0 erratum requires splitting one 8-byte
DS 2-address instruction into two single-address DS instructions — a
replacement larger than the original, necessitating trampoline emission.

Each split correctly scales stride64 offsets, decomposes register pairs
into their sub-registers, and bumps the next `s_wait_dscnt` immediate
(via `MCCodeEmitter` re-encode) to account for the additional
outstanding DS operation. When multiple DS2 sites precede the same wait
instruction, bumps stack correctly (N+K, not N+1).

The replacement sequence is placed in a nearby NOP sled when one is
reachable, otherwise falls back to a trampoline. All operand extraction
uses direct `MCInst` access — no string parsing of printed assembly.

---

Signed-off-by: Surya Jasper <45545431+suryajasper@users.noreply.github.com>
comgr's multithreaded tests was commented out because it would
break with ASAN builds. The break was a bug in ASAN which has now
been [patched upstream](llvm#179000)
Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zizmor found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@accauble accauble deleted the users/accauble/comgr-enable-multithreaded-test branch May 22, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.