[all-commits] [llvm/llvm-project] 95948e: [flang][OpenMP] Support lowering of metadirective ...

Chi-Chun, Chen via All-commits all-commits at lists.llvm.org
Tue May 26 12:48:18 PDT 2026


  Branch: refs/heads/users/cchen/flang-metadirective-static
  Home:   https://github.com/llvm/llvm-project
  Commit: 95948e1ed0accf10e9d07c0e99152d66e24b33cd
      https://github.com/llvm/llvm-project/commit/95948e1ed0accf10e9d07c0e99152d66e24b33cd
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/lib/Lower/OpenMP/Utils.h
    A flang/test/Lower/OpenMP/Todo/metadirective-dynamic.f90
    R flang/test/Lower/OpenMP/Todo/metadirective-exec.f90
    A flang/test/Lower/OpenMP/Todo/metadirective-loop.f90
    R flang/test/Lower/OpenMP/Todo/metadirective-spec.f90
    A flang/test/Lower/OpenMP/Todo/metadirective-target-device.f90
    A flang/test/Lower/OpenMP/metadirective-construct.f90
    A flang/test/Lower/OpenMP/metadirective-device-isa.f90
    A flang/test/Lower/OpenMP/metadirective-device-kind.f90
    A flang/test/Lower/OpenMP/metadirective-implementation.f90
    A flang/test/Lower/OpenMP/metadirective-user.f90

  Log Message:
  -----------
  [flang][OpenMP] Support lowering of metadirective (part 1)

This patch implements following feature in metadirective:
- implementation={vendor(...)}
- device={kind(...), isa(...), arch(...)}
- user={condition(<constant-expr>)}
- construct={parallel, target, teams}
- default, nothing, and otherwise clause

Dynamic user conditions, target_device, and loop-associated
variants are deferred to follow-up patches.

This patch is part of the feature work for #188820.

Assisted with copilot and GPT-5.4


  Commit: 429bbe63f090bcc228cc6da77728609dcd3b2e56
      https://github.com/llvm/llvm-project/commit/429bbe63f090bcc228cc6da77728609dcd3b2e56
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/metadirective-construct.f90
    M flang/test/Lower/OpenMP/metadirective-device-isa.f90
    M flang/test/Lower/OpenMP/metadirective-device-kind.f90
    M flang/test/Lower/OpenMP/metadirective-implementation.f90
    M flang/test/Lower/OpenMP/metadirective-user.f90

  Log Message:
  -----------
  Support begin/end metadirective


  Commit: e123d30b078062a724f5572797b402c29a15c3a0
      https://github.com/llvm/llvm-project/commit/e123d30b078062a724f5572797b402c29a15c3a0
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/Utils.cpp
    R flang/test/Lower/OpenMP/Todo/begin-metadirective.f90
    M flang/test/Lower/OpenMP/Todo/metadirective-target-device.f90
    M flang/test/Lower/OpenMP/metadirective-construct.f90
    A flang/test/Lower/OpenMP/metadirective-device-arch.f90
    M flang/test/Lower/OpenMP/metadirective-device-isa.f90
    M flang/test/Lower/OpenMP/metadirective-device-kind.f90
    M flang/test/Lower/OpenMP/metadirective-implementation.f90
    A flang/test/Lower/OpenMP/metadirective-nothing.f90
    M flang/test/Lower/OpenMP/metadirective-user.f90

  Log Message:
  -----------
  Fix trait-property mapping and improve metadirective tests

- In processTraitProperties, restrict the device_isa___ANY fallback to
  only isa selectors. Unknown properties under arch, kind, or vendor
  now produce an invalid trait so the variant does not match. Previously,
  device={arch("neon")} would incorrectly match via ISA target-feature
  checking.
- Add metadirective-nothing tests for OpenMP version >= 5.1.
- Add explicit -triple flags to ISA tests so AArch64 features run
  under an aarch64 triple and x86 features under an x86_64 triple.
- Split device={arch()} tests into metadirective-device-arch.f90
- Add omp.terminator checks for begin/end metadirective match cases.
- Remove begin-metadirective.f90 TODO test (now supported).

Assisted with copilot


  Commit: be13726bd97a09e815849f9816cfe459496cbf70
      https://github.com/llvm/llvm-project/commit/be13726bd97a09e815849f9816cfe459496cbf70
  Author: chichunchen <chichunchen844 at gmail.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/metadirective-implementation.f90

  Log Message:
  -----------
  Fix metadirective implicit-nothing candidate ordering

Preserve whether a metadirective variant was explicitly
specified so selection can distinguish explicit nothing
from an omitted directive variant. Order explicit candidates
before implicit nothing candidates when invoking the OpenMP
context scorer, matching the metadirective tie-break rule.

Add standalone and begin/end metadirective regression tests
where an implicit nothing candidate appears before an
otherwise-tied explicit directive variant.

Reference:
OpenMP 5.0 [2.3.4] says that if multiple when clauses have
compatible context selectors with the same highest score, and
at least one of them specifies a directive variant, "the first
directive variant specified in the lexical order of those when
clauses" replaces the metadirective.


  Commit: 5823414cab52b342d0de0c78ef3ce6258b62c623
      https://github.com/llvm/llvm-project/commit/5823414cab52b342d0de0c78ef3ce6258b62c623
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp

  Log Message:
  -----------
  Remove redundant MetadirectiveVariant


  Commit: 94069edbc51d4325f9677902003cedf5d5af51a3
      https://github.com/llvm/llvm-project/commit/94069edbc51d4325f9677902003cedf5d5af51a3
  Author: chichunchen <chichunchen844 at gmail.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp

  Log Message:
  -----------
  Fix for construct


  Commit: 9e4dbb22fa71dbbf15d5526388abc10d733eb03c
      https://github.com/llvm/llvm-project/commit/9e4dbb22fa71dbbf15d5526388abc10d733eb03c
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/test/Lower/OpenMP/metadirective-user.f90

  Log Message:
  -----------
  Preserve metadirective user condition scores

The user-condition path returned before getTraitScore was called, so a
score on condition(...) was silently ignored during variant selection.

Extract the score before dispatching user-condition handling, pass it to
the condition traits, and add a test where a scored true condition wins
over an unscored candidate.


  Commit: 7425592371e38ae915520d0c5dd3cd1051639771
      https://github.com/llvm/llvm-project/commit/7425592371e38ae915520d0c5dd3cd1051639771
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/metadirective-construct.f90

  Log Message:
  -----------
  Use selected variants in metadirective construct context

Construct traits gathered only from PFT parents miss constructs introduced
by an enclosing selected begin-metadirective variant. This can cause an
inner construct selector to reject a matching variant.

Use already-emitted enclosing OpenMP operations as the effective context,
falling back to PFT parents when no such operation exists. Add a test for
an inner selector matching target plus an outer-selected parallel.


  Commit: f6633d5a530e705718f67bc7c42c2396f841452d
      https://github.com/llvm/llvm-project/commit/f6633d5a530e705718f67bc7c42c2396f841452d
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Semantics/OpenMP/metadirective-common.f90

  Log Message:
  -----------
  Require a selector when lowering WHEN

This patch ensure we don't have missing selector as unconditional in
lowering since `WHEN` requires a context-selector.

Added negative test to replace the positive test testing against missing
selector.


  Commit: 80207c20193c31986b406453f5a0b91151681e9c
      https://github.com/llvm/llvm-project/commit/80207c20193c31986b406453f5a0b91151681e9c
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M flang/test/Lower/OpenMP/metadirective-device-arch.f90

  Log Message:
  -----------
  Fix device arch negative check coverage


Compare: https://github.com/llvm/llvm-project/compare/9c0cd2792958...80207c20193c

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list