Giter Club home page Giter Club logo

Comments (3)

Dinngger avatar Dinngger commented on June 27, 2024 3

Another bug found.

import taichi as ti
ti.init(ti.cuda)

@ti.kernel
def mytest():
    for _ in range(1):
        x = ti.Vector.zero(ti.f32, 1)
        x[0] = 1
        res = ti.Vector.zero(ti.f32, 1)
        for i in range(1):
            res[i] = 2
        x = res
        print(x)
        print(x[0])

mytest()

The output is

$ python3 ti_vec_func2.py
[Taichi] version 1.8.0, llvm 15.0.4, commit 0da68467, linux, python 3.8.10
[Taichi] Starting on arch=cuda
[2.000000]
1.000000

from taichi.

17794 avatar 17794 commented on June 27, 2024

I also found a puzzling manifestation of taichi,

import taichi as ti
import numpy as np

ti.init(arch=ti.gpu)
num = int(1e9)
@ti.kernel
def speed_test()->ti.float32:
   ti.loop_config(serialize=True)
   s2 = 0.0
   for i in range(num):
      s2+=1.0
   return s2
print(speed_test())
a = np.ones(num,dtype=np.float32)
res = np.array(0.0,dtype=np.float32)
a.sum(out=res)
print(res)

The output is:

[Taichi] version 1.7.1, llvm 15.0.4, commit 0f143b2f, linux, python 3.11.9
[Taichi] Starting on arch=cuda
536870912.0
1000000000.0

from taichi.

bobcao3 avatar bobcao3 commented on June 27, 2024

@Dinngger for your original post, that case is not a bug. Kernel parameters are constant, we supported the syntax because some people relied on the C-like behavior, but the results only persists within a single offload. (e.g. within a single parallel for loop)

We probably should make it a warning

For the second case, weird indeed. I would guess some bug with load to store forwarding did not detect a modification

from taichi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.