[Mlir-commits] [mlir] [OpenMP][MLIR] Fix initTargetRuntimeAttrs, LoopTripCount calculation when host_eval vars is empty (PR #157717)

Sergio Afonso llvmlistbot at llvm.org
Wed Sep 10 04:08:32 PDT 2025


https://github.com/skatrak requested changes to this pull request.

I don't think this change is correct. Having host-evaluated loop bounds is a hard requirement for SPMD kernels (i.e. `target teams distribute parallel do`). Even if they are constants, they must be passed as `host_eval` arguments to `omp.target` when compiling for the host. See for example the unit test at "flang/test/Lower/OpenMP/target-spmd.f90".

It is only when compiling for a target device (i.e. the module attribute `omp.is_target_device=true`) that we don't use `host_eval`.

What is the motivation for this change, is there any code currently producing such invalid MLIR?

https://github.com/llvm/llvm-project/pull/157717


More information about the Mlir-commits mailing list