Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoist trans bug with index into derived type #2849

Open
vkatkinson opened this issue Jan 14, 2025 · 1 comment · May be fixed by #2825
Open

Hoist trans bug with index into derived type #2849

vkatkinson opened this issue Jan 14, 2025 · 1 comment · May be fixed by #2825
Labels
bug NEMO Issue relates to the NEMO domain NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH

Comments

@vkatkinson
Copy link
Collaborator

vkatkinson commented Jan 14, 2025

With NEMO file lbcnfd.f90:

   integer :: ij1
    integer :: ij2

    do jf = 1, kfld, 1
      ipi = SIZE(ptab(jf)%pt4d, 1)
      ipj = SIZE(ptab(jf)%pt4d, 2)
      ipk = SIZE(ptab(jf)%pt4d, 3)
      ipl = SIZE(ptab(jf)%pt4d, 4)
      ihls = (ipi - Ni0glo) / 2
      if (c_NFtype == 'T') then
        if (cd_nat(jf) == 'T' .OR. cd_nat(jf) == 'W') then
          do jl = 1, ipl, 1
            do jk = 1, ipk, 1

With hoist_expressions=True in omp_gpu_trans.py PSyclone generates:

 integer :: loop_stop_15
    integer :: loop_stop_16

    ipi = SIZE(ptab(jf)%pt4d, 1)
    ipj = SIZE(ptab(jf)%pt4d, 2)
    ipk = SIZE(ptab(jf)%pt4d, 3)
    ipl = SIZE(ptab(jf)%pt4d, 4)
    ihls = (ipi - Ni0glo) / 2
    do jf = 1, kfld, 1
      if (c_NFtype == 'T') then
        if (cd_nat(jf) == 'T' .OR. cd_nat(jf) == 'W') then
          loop_stop = Ni0glo - 1
          loop_stop_2 = ihls - 1
          loop_stop_3 = Ni0glo / 2 - 1
@vkatkinson vkatkinson added bug NEMO Issue relates to the NEMO domain NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH labels Jan 14, 2025
arporter added a commit that referenced this issue Jan 14, 2025
arporter added a commit that referenced this issue Jan 14, 2025
@arporter
Copy link
Member

Happily, it seems that the improvements to reference_accesses in #2825 fix this bug. I'll add the test I have here to that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug NEMO Issue relates to the NEMO domain NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH
Projects
Status: No status
2 participants