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

cache loop invariant global vars pass induces incorrect results in serial mode #8578

Open
erizmr opened this issue Aug 5, 2024 · 0 comments

Comments

@erizmr
Copy link
Contributor

erizmr commented Aug 5, 2024

Related issue #8576
Thanks for #8577 from @jim19930609. Based on this PR, there is still an issue in serial mode as shown below

import taichi as ti

ti.init(arch=ti.gpu, print_ir=True, print_ir_dbg_info = False, offline_cache=False, cache_loop_invariant_global_vars=True)

x = ti.field(float, shape=(3, 5))


@ti.kernel
def repro():
    ti.loop_config(serialize=True)
    for i in range(5):
        x[2, i] = x[2, i] + 1.0
        for j in range(1):
            x[2, i] = x[2, i] - 5.0
            print("x value ", x[2, i])
            for z in range(1):
                idx = 0
                if z == 0:
                    idx = 2
                x_print = x[idx, i]
                print("x value inside ", x_print)
                print("x value inside direct access", x[2, i])

repro()
x value  -4.000000
x value inside  1.000000
x value inside direct access -4.000000
x value  -4.000000
x value inside  1.000000
x value inside direct access -4.000000
x value  -4.000000
x value inside  1.000000
x value inside direct access -4.000000
x value  -4.000000
x value inside  1.000000
x value inside direct access -4.000000
x value  -4.000000
x value inside  1.000000
x value inside direct access -4.000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant