Skip to content

Segmentation fault en mode cpu with multiple allocations/to_numpy #8750

@lyounes

Description

@lyounes

The following code running on Mac, Sequoia 15.5

#########################################
import taichi

ti_dtype = taichi.f32
taichi.init(arch=taichi.cpu, debug=True, default_fp=ti_dtype)

n = 1000
dim = 3

repeat = 1000
for k in range(repeat):
print(k)
x_ = taichi.Vector.field(dtype=ti_dtype, shape=(1000,), n=dim)
x_.fill(0.0)
x_.to_numpy()
############################################

triggers a segmentation fault. No error occurs is the allocation is out of the loop, or if to_numpy() is nt called.

Here is the output:

[Taichi] version 1.7.2, llvm 15.0.5, commit 0131dce, osx, python 3.12.8
[Taichi] Starting on arch=x64
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[E 07/26/25 15:19:52.092 3514783] Received signal 11 (Segmentation fault: 11)

[E 07/26/25 15:19:52.092 3514770] Received signal 11 (Segmentation fault: 11)

                        * Taichi Core - Stack Traceback *                             

==========================================================================================
| Module | Offset | Function |
|----------------------------------------------------------------------------------------|

  • taichi_python.cpython-312-darwin.so | 140 | taichi::Logger::error(std::_1::basic |
    | string<char, std::__1::char_traits, std |
    | ::__1::allocator> const&, bool) |
  • taichi_python.cpython-312-darwin.so | 418 | taichi::(anonymous namespace)::signal_ |
    | handler(int) |
  • libsystem_platform.dylib |      29 | (null)                                        |
    

==========================================================================================

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi-lang.org/docs/install

                        * Taichi Core - Stack Traceback *                             

==========================================================================================
| Module | Offset | Function |
|----------------------------------------------------------------------------------------|

  • taichi_python.cpython-312-darwin.so | 140 | taichi::Logger::error(std::_1::basic |
    | string<char, std::__1::char_traits, std |
    | ::__1::allocator> const&, bool) |
  • taichi_python.cpython-312-darwin.so | 418 | taichi::(anonymous namespace)::signal_ |
    | handler(int) |
  • libsystem_platform.dylib |      29 | (null)                                        |
    

==========================================================================================

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi-lang.org/docs/install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions