[Mlir-commits] [mlir] [OpenMP][MLIR] Fix initTargetRuntimeAttrs, LoopTripCount calculation when host_eval vars is empty (PR #157717)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 10 09:02:06 PDT 2025
skc7 wrote:
> 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?
This change is required for #140523 workdistribute construct lowering, where in a fir.do_loop unordered is identified under `target teams workdistribute` region and then lowered to `target{teams{parallel{distribute{wsloop{loop_nest}}}`.
The test mentioned in this PR passes the verifier, but crashes at lowering from openmp to llvm ir.
I'm unaware that host_eval clause needs to have loop bounds information even though they are constants.
https://github.com/llvm/llvm-project/pull/157717
More information about the Mlir-commits
mailing list