Skip to content

Wrap hipMalloc/hipMemcpy interfaces to 132 columns (ifort support)#388

Merged
amontoison merged 1 commit into
ROCm:developfrom
amontoison:wrap-hand-written-interfaces
Jul 25, 2026
Merged

Wrap hipMalloc/hipMemcpy interfaces to 132 columns (ifort support)#388
amontoison merged 1 commit into
ROCm:developfrom
amontoison:wrap-hand-written-interfaces

Conversation

@amontoison

@amontoison amontoison commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

The generated bindings were already wrapped to 132 columns, but the two hand-written interface files were not:

File Lines > 132 Longest line
lib/hipfort/hipfort_hipmalloc.F90 705 259
lib/hipfort/hipfort_hipmemcpy.F90 42 143

The classic Intel Fortran compiler (ifort) caps free-form source lines at 132 columns with no option to extend them, so these two files were the last thing preventing an ifort build (see #123).

Change

Wrap the over-long lines to ≤132 columns, in a readable way:

  • Code lines are broken after a comma (outside string literals), with the continuation indented — the usual Fortran style.
  • Long ERROR STOP messages are split into concatenated string literals ("..." // "..."), which is a constant expression, so the message text is unchanged.

(390 lines broken after commas, 315 strings split, across the two files.) No logic changes.

Verification

  • Each wrap was checked to reconstruct the original statement exactly: comma breaks are byte-identical after free-form continuation processing, and the split ERROR STOP strings concatenate back to the original text.
  • No line in lib/hipfort/ now exceeds 132 columns.
  • The whole lib/hipfort tree compiles with gfortran under -ffree-line-length-132 -Werror=line-truncation, i.e. within ifort's hard 132-column limit (a direct proxy, since no Intel compiler was available in the test environment).

Follow-up

With this merged, cmake/toolchains/intel-classic.cmake (added in #347) can drop its "lines longer than 132 columns → build may fail" warning.

@amontoison
amontoison requested a review from cgmb as a code owner July 25, 2026 00:23
hipfort_hipmalloc.F90 and hipfort_hipmemcpy.F90 are the hand-written
interface files; unlike the generated bindings (already wrapped), they
still contained free-form source lines up to 259 columns. The classic
Intel Fortran compiler (ifort) caps free-form lines at 132 columns with
no extension option, so these files prevented an ifort build (see ROCm#123).

Wrap the over-long lines to <=132 columns:
- code lines are broken after a comma (outside string literals), with the
  continuation indented, which reads naturally;
- long ERROR STOP messages are split into concatenated string literals
  ("..." // "..."), a constant expression, so the message is unchanged.

Each wrap was verified to reconstruct the original statement exactly
(comma breaks are byte-identical after continuation processing; the split
ERROR STOP strings concatenate back to the original text). The whole
lib/hipfort tree compiles with gfortran under -ffree-line-length-132
-Werror=line-truncation, i.e. within ifort's hard 132-column limit.
@amontoison
amontoison force-pushed the wrap-hand-written-interfaces branch from 53eb7f5 to 3ae87e9 Compare July 25, 2026 00:34
@amontoison
amontoison merged commit 0a0e128 into ROCm:develop Jul 25, 2026
1 check was pending
@amontoison
amontoison deleted the wrap-hand-written-interfaces branch July 25, 2026 00:35
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.

1 participant