Skip to content

Enable flang and openmp use throughout ROCm. - #3928

Open
stellaraccident wants to merge 26 commits into
mainfrom
users/stellaraccident/fortran-first-class-take2
Open

stellaraccident wants to merge 26 commits into
mainfrom
users/stellaraccident/fortran-first-class-take2

Conversation

@stellaraccident

@stellaraccident stellaraccident commented Mar 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Splits the ROCm LLVM build into a small bootstrap compiler plus optional Fortran and OpenMP/offload layers, then adjusts TheRock's build topology so downstream projects can consume the right compiler view without forcing every build to pay for Flang/offload.

The main goals are:

  • Build a base LLVM compiler that contains Clang/LLD/backends/device-libs, but not Flang, MLIR, OpenMP/offload, or flang-rt.
  • Keep Fortran and offload available for full Linux builds, while allowing minimal HIP/runtime builds to disable Fortran/offload completely.
  • Make downstream Fortran use explicit via TheRock subproject metadata and the ROCM_BUILD_FORTRAN_LIBS flag.
  • Avoid advertising LLVM's installed OpenMP CMake config as the global provider for find_package(OpenMP).
  • Collapse the old foundation stage into compiler-runtime so CI does not add a lightweight root stage or require a second LLVM checkout.
  • Move hip-tests and rocrtst to a separate runtime-tests stage so runtime tests do not rebuild on downstream stages that only need HIP/core runtime artifacts.

LLVM Layering

The LLVM-related artifacts are now layered as follows:

  • amd-llvm-base: bootstrap compiler layer. Builds the LLVM project with clang, lld, clang-tools-extra, X86/AMDGPU targets, compiler-rt/device-libs, and no Flang/MLIR/OpenMP/offload. This is the base compiler used by later layers.
  • amd-llvm: compiler infrastructure layer. Builds amd-comgr and hipcc on top of amd-llvm-base.
  • amd-llvm-flang: optional Linux-only Flang frontend layer. Builds Flang/MLIR as implementation details needed by the frontend, but does not install MLIR into the final ROCm dist.
  • amd-llvm-offload: optional Linux-only runtime layer. Builds OpenMP/offload runtimes and, when Flang is enabled, flang runtime pieces. Depends on amd-llvm, amd-llvm-flang when enabled, and core-runtime.

hip-clr uses the amd-llvm-offload compiler view when that target exists. That keeps HIP, Flang, OpenMP headers/libraries, and offload runtime visibility together in the amd-hip toolchain view without making the base compiler advertise OpenMP globally.

Build Topology

The old foundation stage has been removed. Its former artifact groups are now part of compiler-runtime:

  • third-party-sysdeps
  • base
  • compiler
  • core/runtime/profiler groups

This avoids a root stage that mostly adds critical path and avoids splitting LLVM-related source checkout/build behavior across stages.

A new runtime-tests stage contains:

  • core-hiptests
  • rocrtst

runtime-tests depends on the runtime/compiler artifacts it needs and runs parallel to math-libs. Linux builds both hip-tests and rocrtst; Windows has the same stage so core-hiptests artifacts are still produced, while rocrtst remains disabled by platform metadata.

Fortran Controls

This adds or wires:

  • THEROCK_ENABLE_FLANG
  • THEROCK_ENABLE_AMD_LLVM_OFFLOAD
  • THEROCK_FLAG_BUILD_FORTRAN_LIBS
  • FORTRAN_OPTIONAL / FORTRAN_REQUIRED subproject declaration keywords
  • ROCM_BUILD_FORTRAN_LIBS=ON/OFF propagation to downstream subprojects

Known Fortran consumers can now declare whether Fortran is optional or required. When Fortran libs are disabled, optional users can configure without forcing Flang/offload into the build.

OpenMP Handling

  • HIP-facing projects get OpenMP visibility through the amd-hip toolchain view when hip-clr is built on top of amd-llvm-offload.
  • rocprofiler-systems gets a targeted pre-hook that passes libomptarget explicitly and seeds module-mode FindOpenMP cache entries where needed.
  • GCC-configured subprojects use GCC's own libgomp path, avoiding accidental selection of the offload package's libgomp.so shim.

Downstream Wiring

The change updates downstream projects that need Fortran/OpenMP awareness, including RAND/BLAS-family projects and rocprofiler-systems.

Notable fixes:

  • Math library Fortran wrappers are gated by ROCM_BUILD_FORTRAN_LIBS.
  • rocprofiler-systems receives the offload library directory explicitly for libomptarget.
  • rocprofiler-systems examples are disabled in TheRock integration builds to avoid using deep example builds as the first test of the Fortran/offload toolchain.

Verification

Local verification was done on a gfx1100 machine.

Static checks:

python build_tools/topology_to_cmake.py --validate-only
python build_tools/configure_stage.py --stage compiler-runtime --print
python build_tools/configure_stage.py --stage runtime-tests --print
python build_tools/configure_stage.py --stage runtime-tests --platform windows --print
python -m unittest discover -s build_tools/github_actions/tests -p configure_multi_arch_ci_test.py
python -m unittest build_tools.tests.build_topology_test build_tools.github_actions.tests.post_stage_upload_test
git diff --check

No-Fortran HIP/RAND build:

  • Configured with THEROCK_ENABLE_ALL=OFF, THEROCK_ENABLE_HIP_RUNTIME=ON, THEROCK_ENABLE_RAND=ON, THEROCK_ENABLE_FLANG=OFF, THEROCK_ENABLE_AMD_LLVM_OFFLOAD=OFF, and THEROCK_FLAG_BUILD_FORTRAN_LIBS=OFF.
  • Built dist-rocm.
  • Verified the dist contains HIP/RAND pieces and does not contain Flang/OpenMP/offload outputs such as amdflang, flang, libomp.so, libomptarget.so, omp_lib.mod, or libflang_rt*.
  • Built and ran a tiny HIP smoke test with hipcc --offload-arch=gfx1100.

Fortran/offload toolchain build:

  • Configured with compiler/core runtime/HIP/RAND/BLAS enabled plus THEROCK_ENABLE_FLANG=ON, THEROCK_ENABLE_AMD_LLVM_OFFLOAD=ON, and THEROCK_FLAG_BUILD_FORTRAN_LIBS=ON.
  • Built and verified amd-llvm-base, amd-llvm, amd-llvm-flang, amd-llvm-offload, HIP runtime, RAND, and BLAS-family artifacts.
  • Verified dist/rocm contains amdflang, flang, omp_lib.mod, flang runtime libraries, libomp.so, libomptarget.so, AMDGCN device runtime pieces, BLAS/RAND libraries, and no installed MLIR CMake package in the final ROCm dist.
  • Passed small Fortran, Fortran OpenMP, C OpenMP offload, Fortran OpenMP/offload, and HIP smoke tests.

BLAS/RAND integration:

  • Expunged cached downstreams after toolchain changes.
  • Built/refreshed mxDataGenerator, hipBLASLt, rocBLAS, hipBLAS, rocRAND, and hipRAND.
  • Confirmed Fortran wrappers are enabled in the Fortran build and absent in the no-Fortran build.

@stellaraccident stellaraccident changed the title POC: First class fortran/openmp/offload plumbing (take 2) Split amd-llvm into base/flang/offload sub-projects and re-layer build order Mar 12, 2026
@stellaraccident
stellaraccident marked this pull request as ready for review March 12, 2026 06:37
@stellaraccident
stellaraccident requested a review from ronlieb March 12, 2026 06:40
@marbre

marbre commented Mar 12, 2026

Copy link
Copy Markdown
Member

Builds are failing:

[rocprofiler-systems configure] -- Checking out 'https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV.git' @ 'master'...
[rocprofiler-systems configure] Cloning into 'external/ompvv'...
[rocprofiler-systems configure] CMake Error at cmake/MacroUtilities.cmake:20 (message):
[rocprofiler-systems configure]   [rocprofiler-systems] Could not find amdflang.  This is required for the
[rocprofiler-systems configure]   OMPVV tests.
[rocprofiler-systems configure] Call Stack (most recent call first):
[rocprofiler-systems configure]   examples/openmp/external/CMakeLists.txt:184 (rocprofiler_systems_message)
[rocprofiler-systems configure] 
[rocprofiler-systems configure] 
[rocprofiler-systems configure] -- Configuring incomplete, errors occurred!

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall looks good once the CI passes

Comment thread compiler/artifact-core-runtime.toml Resolved
Comment thread base/artifact-amd-llvm-base.toml Resolved
Comment thread BUILD_TOPOLOGY.toml Resolved
Comment thread cmake/therock_subproject.cmake Resolved
@stellaraccident

Copy link
Copy Markdown
Collaborator Author

Try 2.

@marbre

marbre commented Mar 18, 2026

Copy link
Copy Markdown
Member

Try 2.

[rocRoller configure] CMake Error at /__w/TheRock/TheRock/rocm-libraries/shared/mxdatagenerator/CMakeLists.txt:14 (target_link_libraries):
[rocRoller configure]   The link interface of target "mxDataGenerator" contains:
[rocRoller configure] 
[rocRoller configure]     OpenMP::OpenMP_CXX
[rocRoller configure] 
[rocRoller configure]   but the target was not found.  Possible reasons include:
[rocRoller configure] 
[rocRoller configure]     * There is a typo in the target name.
[rocRoller configure]     * A find_package call is missing for an IMPORTED target.
[rocRoller configure]     * An ALIAS target is missing.
[rocRoller configure] 
[rocRoller configure] 
[rocRoller configure] 
[rocRoller configure] CMake Error at test/common/CMakeLists.txt:7 (target_link_libraries):
[rocRoller configure]   Target "common-test-utilities" links to:
[rocRoller configure] 
[rocRoller configure]     OpenMP::OpenMP_CXX
[rocRoller configure] 
[rocRoller configure]   but the target was not found.  Possible reasons include:
[rocRoller configure] 
[rocRoller configure]     * There is a typo in the target name.
[rocRoller configure]     * A find_package call is missing for an IMPORTED target.
[rocRoller configure]     * An ALIAS target is missing.

😢

@ronlieb

ronlieb commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

what are the valid combinations of the 3 amd-llvm*

can amd-llvm + amd-llvm-offload be built ?

same for amd-llvm + amd-llvm-flang ?

if i specify amd-llvm-flang does it imply amd-llvm ? or do i need to explicitly as for amd-llvm?

stellaraccident added a commit that referenced this pull request Apr 1, 2026
LLVM's openmp-config.cmake exports OpenMP::omp, not OpenMP::OpenMP_CXX.
When provide_package redirected find_package(OpenMP) to the LLVM config,
downstream consumers (rocRoller, mxdatagenerator) that link against
OpenMP::OpenMP_CXX failed at configure time. Removing the provide_package
lets CMake's built-in FindOpenMP module handle detection, which correctly
creates the OpenMP::OpenMP_CXX target.

Fixes: #3928 (marbre report on "Try 2")

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stellaraccident

Copy link
Copy Markdown
Collaborator Author

what are the valid combinations of the 3 amd-llvm*

can amd-llvm + amd-llvm-offload be built ?

same for amd-llvm + amd-llvm-flang ?

if i specify amd-llvm-flang does it imply amd-llvm ? or do i need to explicitly as for amd-llvm?

My agent organized my answer a bit:

The three sub-projects form a dependency chain:

  • amd-llvm-base → always built. Minimal compiler: clang, lld, compiler-rt, device-libs, openmp host runtime.
  • amd-llvm → depends on amd-llvm-base. Adds comgr, hipify, etc. This is what most of ROCm needs.
  • amd-llvm-flang → depends on amd-llvm. Adds the flang compiler frontend (+ MLIR). Linux-only, gated by THEROCK_ENABLE_FLANG.
  • amd-llvm-offload → depends on amd-llvm, and optionally on amd-llvm-flang. Adds libomptarget, device RTLs, and (if flang is enabled) flang-rt device runtime. Linux-only.

Valid combinations:

  • amd-llvm + amd-llvm-offload (no flang): Yes. You get libomptarget + device RTLs but no flang-rt. C/C++ OpenMP offload works, Fortran doesn't.
  • amd-llvm + amd-llvm-flang (no offload): Technically valid but not useful — you get the flang compiler binary but no Fortran runtime (flang-rt lives in amd-llvm-offload), so you can't link anything.
  • All three: The full stack. flang frontend + flang-rt + offload runtimes.

Dependencies are enforced via artifact_deps in the topology, so enabling amd-llvm-flang automatically pulls in amd-llvm — you don't need to request it explicitly.

@marbre

marbre commented Apr 1, 2026

Copy link
Copy Markdown
Member
[rocprofiler-systems] error: Semantic errors in /__w/TheRock/TheRock/build/profiler/rocprofiler-systems/build/examples/openmp/external/ompvv/tests/5.0/teams/test_team_default_shared.F90
[rocprofiler-systems] /__w/TheRock/TheRock/build/profiler/rocprofiler-systems/build/examples/openmp/external/ompvv/tests/5.0/teams/test_team_default_shared.F90:28:7: error: Cannot parse module file for module 'iso_fortran_env': Source file 'iso_fortran_env.mod' was not found
[rocprofiler-systems]     USE iso_fortran_env
[rocprofiler-systems]         ^^^^^^^^^^^^^^^
[rocprofiler-systems] /__w/TheRock/TheRock/build/profiler/rocprofiler-

In the latest run rocprofiler-systems is unhappy about the Fortran related changes.

@ScottTodd
ScottTodd self-requested a review April 1, 2026 18:30
@stellaraccident
stellaraccident force-pushed the users/stellaraccident/fortran-first-class-take2 branch from 5c0a394 to 9879624 Compare May 2, 2026 05:38
@stellaraccident

Copy link
Copy Markdown
Collaborator Author

A month later - needs more cleanup before landing but pushing a WIP branch that passes my local build to see what CI says.

Comment thread compiler/amd-llvm-flang/CMakeLists.txt Resolved
Comment thread core/CMakeLists.txt Resolved
Comment thread core/CMakeLists.txt Resolved
Comment thread core/CMakeLists.txt Resolved
Comment thread profiler/CMakeLists.txt Resolved
@stellaraccident stellaraccident changed the title Split amd-llvm into base/flang/offload sub-projects and re-layer build order Enable flang and openmp use throughout ROCm. May 2, 2026
stellaraccident and others added 4 commits May 3, 2026 21:23
Changes:
- Add amd-llvm-base as a foundation compiler artifact without Flang/OpenMP/offload.
- Add optional amd-llvm-flang and amd-llvm-offload layers with flang-rt and OpenMP runtime packaging.
- Wire Fortran optional subproject behavior and initial ROCm consumers.
- Add tactical LLVM patches for split OpenMP/offload builds.

Generated with Claude Code.

Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
- Stop advertising LLVM OpenMP config as the global OpenMP provider.
- Build hip-clr against amd-llvm-offload when that layer is enabled so the normal amd-hip toolchain carries HIP, Flang, and OpenMP together.
- Keep rocprofiler-systems' LLVM OpenMP config shim local and explicit.

Generated with Claude Code

Co-authored-by: Claude <noreply@anthropic.com>
Changes:
- Remove the foundation stage and fold sysdeps/base into compiler-runtime.
- Add a runtime-tests stage for hip-tests and rocrtst in multi-stage CI.
- Keep rocprofiler-systems on module-mode OpenMP hints instead of LLVM OpenMP config mode.

Generated with Claude Code
@stellaraccident
stellaraccident force-pushed the users/stellaraccident/fortran-first-class-take2 branch from baff225 to c83335c Compare May 4, 2026 04:23
Changes:

- keep kpacked test host binaries paired with per-ISA artifacts instead of publishing them through shared generic test artifacts

- keep setuptools and wheel in setup_venv-created venvs and disable build isolation for explicit artifact-only installs

- cover the no-index setup_venv command shape in unit tests

Claude Code
Changes:

- normalize hipblas-test's Windows process status to 0 when GTest reports success

- keep quick_exit on Windows so post-main DLL cleanup still does not run

Claude Code
stellaraccident added a commit that referenced this pull request May 9, 2026
Partial landing split from #3928.

Changes:

- Replace install(FILES) for the root llvm and amdgcn directory symlinks
with install(CODE) that creates the symlinks at install time.

- Create the install prefix inside the install code before creating
root-level symlinks; local validation showed the closed #4301 form
failed when the prefix did not exist yet.

- Leave the existing amdflang symlink behavior unchanged; conditional
Fortran symlink handling remains with the split compiler work.

Rationale:

- CMake install(FILES) rejects directory symlinks, which breaks
aux-overlay installation for the SDK layout symlinks tracked by #3714.

Validation:

- cmake -S base/aux-overlay -B /tmp/therock-aux-overlay-test-build
-GNinja
-DTHEROCK_SOURCE_DIR=/srv/vm-shared/projects/therock-workspace1/worktrees/TheRock
-DTHEROCK_PACKAGE_VERSION=0.0.0 -DGPU_TARGETS=gfx1100

- cmake --build /tmp/therock-aux-overlay-test-build

- cmake --install /tmp/therock-aux-overlay-test-build --prefix
/tmp/therock-aux-overlay-test-install

- verified llvm, amdgcn, and bin/amdclang are symlinks in
/tmp/therock-aux-overlay-test-install

- git diff --cached --check

Generated with Codex
stellaraccident added a commit that referenced this pull request May 9, 2026
Partial landing split from #3928.

Changes:

- When a stage depends on an artifact group, include not only the
artifacts produced by that group but also each artifact's transitive
artifact dependencies.

- Add topology regression coverage for a group dependency where a
pulled-in artifact depends on additional toolchain artifacts from the
same producer group.

Rationale:

- Multi-stage CI fetches stage inputs from get_inbound_artifacts().
Without this closure, a downstream stage can fetch a higher-level
artifact while missing lower-level artifacts that it needs at
configure/build time.

- This is a standalone topology correctness fix that derisks the split
compiler artifacts from #3928.

Validation:

- python -m unittest build_tools.tests.build_topology_test

- python build_tools/topology_to_cmake.py --validate-only

- git diff --cached --check

Generated with Codex

When OpenMP is built standalone against an installed LLVM tree,
LIBOMP_HEADERS_INTDIR can point at the installed LLVM resource include
directory instead of the local runtime build directory. That makes GCC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldnt this build of openmp files always use clang rather than gcc ?

@lumachad

Copy link
Copy Markdown
Contributor

I wonder if we need to wire something in the cmake/therock_sanitizers.cmake to handle passing sanitizer options to flang.

Comment on lines +84 to +93
if(TARGET FortranSupport AND TARGET MLIRBuiltinTypeInterfacesIncGen)
add_dependencies(FortranSupport MLIRBuiltinTypeInterfacesIncGen)
endif()
if(TARGET FIRSupport AND TARGET MLIRLinalgOpsIncGen)
add_dependencies(FIRSupport MLIRLinalgOpsIncGen)
endif()
if(TARGET FortranSupport)
target_include_directories(FortranSupport PRIVATE
${CMAKE_BINARY_DIR}/flang/lib/Support)
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Followup from today's conversation:

I think duplicating the CMakeLists.txt from upstream is highly undesirable. If changes upstream, it is hard to debug what changes and replicated it in this copy of CMakeLists.txt. FLANG_INCLUDE_QUADMATH_H is a great example for this: Build will not fail initially, but REAL(16) will be silently unavailable and some poor soul has to find out why. I am planning larger changes to this file upstream (llvm/llvm-project#171515) and would rather not have to do the same a second time for TheRock.

Upstream LLVM already has a means to build components separately in standalone builds. That is: LLVM+Flang -> MLIR -> Flang. You mentioned the disadvantage is that the MLIR build includes a lot of other stuff that is actually not needed for Flang, and a common build dir just handles dependency resolution.

This is an argument for MLIR, Flang which are build through LLVM_ENABLE_PROJECTS, but not for LLVM_ENABLE_RUNTIMES (i.e. amd-llvm-offload). A runtimes build can build multiple runtimes via passing them all to LLVM_ENABLE_RUNTIMES, e.g -DLLVM_ENABLE_RUNTIMES=openmp;offload.

For MLIR, it would be less work to only build the components actually needed, either by ninja MLIRLinalgOpsIncGen ..., creating a new target in our downstream llvm-project (such as

add_custom_target(mlir-flang-deps)
add_dependencies(mlir-flang-deps MLIRLinalgOpsIncGen  ...)

) that depend only on needed targets, or straight up commenting-out upstream components that we do not need. Dependencies are already managed in this CMakeLists copy and a missing dependency due to an upstream change is much more obvious than hunting down changes to configuration parameters.

If we have to manually manage out top-level dependencies anyway, why not keep everything in a single build dir and create targets that only build/install components that are needed (replacing ninja all and ninja install)? From AI:

# Install base_lib into the "base" component
install(TARGETS base_lib 
        DESTINATION lib 
        COMPONENT base)

# Create the custom target for 'ninja install-base'
add_custom_target(install-base
    # 1. The command to run the component-specific install
    COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --component base
    
    # 2. The targets that MUST be built before installing
    DEPENDS base_lib
    
    COMMENT "Building and installing the 'base' component..."
)

(upstream LLVM already uses COMPONENT in install commands)

or reconfigure the same build dir with LLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS};flang a second build to incrementally build flang on top of the previous build.

stellaraccident added a commit that referenced this pull request Jun 1, 2026
Partial landing split from #3928.

Changes:

- Remove the foundation stage and fold sysdeps/base into compiler-runtime.

- Add a runtime-tests stage for hip-tests and rocrtst so runtime test builds no longer sit on the compiler-runtime critical path.

- Update multi-stage workflow dependencies, helper text, docs, and CI unit-test expectations for the new stage layout.

- Keep rocprofiler-systems OpenMP/example changes out of this split; those remain separate from the topology refactor.

Evidence:

- python build_tools/topology_to_cmake.py --validate-only

- python -m pytest build_tools/tests/build_topology_test.py build_tools/github_actions/tests/configure_multi_arch_ci_test.py

- python build_tools/configure_stage.py --stage compiler-runtime --print

- python build_tools/configure_stage.py --stage runtime-tests --print

Generated with Claude Code
stellaraccident added a commit that referenced this pull request Jun 2, 2026
Partial landing split from #3928.

Changes:

- Remove the foundation stage and fold sysdeps/base into
compiler-runtime.

- Add a runtime-tests stage for hip-tests and rocrtst so runtime test
builds no longer sit on the compiler-runtime critical path.

- Update multi-stage workflow dependencies, helper text, docs, and CI
unit-test expectations for the new stage layout.
geomin12 pushed a commit that referenced this pull request Jun 15, 2026
Partial landing split from #3928.

Changes:

- Keep setuptools and wheel available when setup_venv updates a venv so
ROCm sdists can build without resolving build dependencies from the
package index under test.

- Treat an explicit empty --index-url as an artifact-only install
request and pass pip --no-index --no-build-isolation while preserving
--find-links.

- Add unit coverage for the empty-index command shape.

Validation:

- python -m unittest build_tools.tests.setup_venv_test

- git diff --cached --check

Generated with Codex

Co-authored-by: Scott Todd <Scott.Todd@amd.com>
TorreZuk added a commit to ROCm/rocm-libraries that referenced this pull request Jul 15, 2026
Partial upstream split from ROCm/TheRock#3928.

Changes:

- Rename the local HIP C binding function result from c_int to
hip_status in the rocBLAS Fortran samples.

- Declare the renamed result explicitly as integer(c_int) under implicit
none.

Rationale:

- The samples imported iso_c_binding::c_int and also used result(c_int),
which makes the function result name collide with the imported kind
name.

- Flang diagnoses the collision and missing explicit result type;
gfortran also accepts the explicit non-conflicting result name.

Validation:

- Applied on current rocm-libraries develop after git pull --ff-only
origin develop.

- gfortran -fsyntax-only on example_fortran_{axpy,gemv,scal}.f90 with
temporary stub rocblas modules.

- git diff --check.

Generated with Codex

---------

Co-authored-by: Michael Klemm <michael.klemm@amd.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Torre Zuk <Torre.Zuk@amd.com>
assistant-librarian Bot pushed a commit to ROCm/rocBLAS that referenced this pull request Jul 15, 2026
rocBLAS: Fix Fortran sample HIP result names

Partial upstream split from ROCm/TheRock#3928.

Changes:

- Rename the local HIP C binding function result from c_int to
hip_status in the rocBLAS Fortran samples.

- Declare the renamed result explicitly as integer(c_int) under implicit
none.

Rationale:

- The samples imported iso_c_binding::c_int and also used result(c_int),
which makes the function result name collide with the imported kind
name.

- Flang diagnoses the collision and missing explicit result type;
gfortran also accepts the explicit non-conflicting result name.

Validation:

- Applied on current rocm-libraries develop after git pull --ff-only
origin develop.

- gfortran -fsyntax-only on example_fortran_{axpy,gemv,scal}.f90 with
temporary stub rocblas modules.

- git diff --check.

Generated with Codex
pschang-phy pushed a commit to ROCm/rocm-libraries that referenced this pull request Jul 17, 2026
Partial upstream split from ROCm/TheRock#3928.

Changes:

- Rename the local HIP C binding function result from c_int to
hip_status in the rocBLAS Fortran samples.

- Declare the renamed result explicitly as integer(c_int) under implicit
none.

Rationale:

- The samples imported iso_c_binding::c_int and also used result(c_int),
which makes the function result name collide with the imported kind
name.

- Flang diagnoses the collision and missing explicit result type;
gfortran also accepts the explicit non-conflicting result name.

Validation:

- Applied on current rocm-libraries develop after git pull --ff-only
origin develop.

- gfortran -fsyntax-only on example_fortran_{axpy,gemv,scal}.f90 with
temporary stub rocblas modules.

- git diff --check.

Generated with Codex

---------

Co-authored-by: Michael Klemm <michael.klemm@amd.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Torre Zuk <Torre.Zuk@amd.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

6 participants