taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.53k stars 2.29k forks source link

ti.random is not random on Vulkan on macOS #7645

Open jarmitage opened 1 year ago

jarmitage commented 1 year ago

Relevant docs: https://docs.taichi-lang.org/docs/global_settings#runtime

To set a custom seed for the random number generator used by ti.random(): ti.init(random_seed=seed). seed should be an integer. An example: ti.init(random_seed=int(time.time())).

import time
import taichi as ti
ti.init(arch=ti.vulkan,random_seed=int(time.time()))
@ti.kernel
def main() -> ti.f32:
    return ti.random(ti.f32)
print(main())
➜  test.py
[Taichi] version 1.6.0, llvm 16.0.0git, commit 1fc985e3, osx, python 3.10.6
[Taichi] Starting on arch=vulkan
RHI Error: Potential non-conformant Vulkan implementation, enabling VK_KHR_portability_subset
0.7819478511810303
➜  test.py
[Taichi] version 1.6.0, llvm 16.0.0git, commit 1fc985e3, osx, python 3.10.6
[Taichi] Starting on arch=vulkan
RHI Error: Potential non-conformant Vulkan implementation, enabling VK_KHR_portability_subset
0.7819478511810303
➜  test.py
[Taichi] version 1.6.0, llvm 16.0.0git, commit 1fc985e3, osx, python 3.10.6
[Taichi] Starting on arch=vulkan
RHI Error: Potential non-conformant Vulkan implementation, enabling VK_KHR_portability_subset
0.7819478511810303

macOS 12.6 (21G115), M1

burhanuddin6 commented 7 months ago

This issue is also on the cpu