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

[BUG] LLVM ERROR: out of memory #3515

Closed
chadat23 opened this issue Sep 21, 2024 · 3 comments
Closed

[BUG] LLVM ERROR: out of memory #3515

chadat23 opened this issue Sep 21, 2024 · 3 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@chadat23
Copy link

Bug description

I had some very basic tutorial sorts of things working, then I tried to get a little fancier, using tensors, and received the below message:

(nnfs) chad@ComputerBot:~/mojo/nnfs$ mojo ch02.mojo
LLVM ERROR: out of memory
Allocation failed
[14384:14384:20240920,235455.687881:ERROR elf_dynamic_array_reader.h:64] tag not found
[14384:14384:20240920,235455.688169:ERROR elf_dynamic_array_reader.h:64] tag not found
[14384:14384:20240920,235455.688755:ERROR elf_dynamic_array_reader.h:64] tag not found
[14384:14384:20240920,235455.688852:ERROR elf_dynamic_array_reader.h:64] tag not found
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo ch02.mojo
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
0 mojo 0x000055d0c093847b
1 mojo 0x000055d0c09363d9
2 mojo 0x000055d0c0938b1d
3 libc.so.6 0x00007fa4280b9050
4 libc.so.6 0x00007fa428107e3c
5 libc.so.6 0x00007fa4280b8fb2 gsignal + 18
6 libc.so.6 0x00007fa4280a3472 abort + 211
7 mojo 0x000055d0c0905df9
8 mojo 0x000055d0c0905e45
9 libAsyncRTRuntimeGlobals.so 0x00007fa4285653c3
10 libAsyncRTRuntimeGlobals.so 0x00007fa428574164
11 libKGENCompilerRTShared.so 0x00007fa424ede389 KGEN_CompilerRT_AlignedAlloc + 137
12 libKGENCompilerRTShared.so 0x00007fa3cf1b7348 KGEN_CompilerRT_AlignedAlloc + 18446744072269697096
mojo crashed!
Please file a bug report.
Aborted (core dumped)

It happened every time I tried to run the code. I don't know what to make of it but it says to submit a bug report so...!

Steps to reproduce

Here's the code:

from tensor import Tensor

def main():
var inputs = SIMD[DType.float64, 4](1, 2, 3, 2.5)
var weights = Tensor[DType.float64](3, 4)
weights = ((0.2, 0.8, -0.5, 1), (0.5, -0.91, 0.26, -0.5), (-0.26, -0.27, 0.17, 0.87))
var biases = SIMD[DType.float64, 4](2, 3, 0.5)

var outputs = SIMD[DType.float64, 4](0, 0, 0)
for i in range(weights.dim(0)):
    for j in range(weights.dim(1)):
        outputs[i] += inputs[i] * weights[i][j]
    outputs[i] += biases[i]

print(outputs)

System information

OS: Debian 12
mojo 24.5.0 (e8aacb95)
modular version: "bash: modular: command not found", but as I said, I did previously compile a few things with mojo after installing things via the curl command from the Getting Started page earlier today
@chadat23 chadat23 added bug Something isn't working mojo-repo Tag all issues with this label labels Sep 21, 2024
@Moosems
Copy link

Moosems commented Sep 23, 2024

How much memory does your system have?

Copy link
Collaborator

Are you following a specific tutorial here? It looks like you're adapting https://github.com/kumaraayush67/NNFS from Python?

I don't see a Tensor initializer that will take a tuple of tuples like this. (In which case the compiler should really give a more helpful error than "out of memory.").

But you could initialize a Tensor with a variadic list of values. That would look like this:

`var weights = Tensor[DType.float64](shape, 0.2, 0.8, -0.5, 1, 0.5, -0.91, 0.26, -0.5, -0.26, -0.27, 0.17, 0.87)`

If you copied this Mojo code from somewhere, please let us know so we can get it fixed.

@scottamain scottamain added the mojo Issues that are related to mojo label Sep 23, 2024 — with Linear
@arthurevans arthurevans removed the mojo Issues that are related to mojo label Sep 24, 2024
@chadat23
Copy link
Author

Only 6 gigs of ram (I wasn't planning on running meaningful modelings on this computer, just learn some language basics)

Motivated by the second comment, I ended up with the below code which runs.

from tensor import Tensor, TensorShape

def main():
var inputs = SIMD[DType.float64, 4](1, 2, 3, 2.5)
var weights = Tensor[DType.float64](
TensorShape(3, 4),
0.2, 0.8, -0.5, 1,
0.5, -0.91, 0.26, -0.5,
-0.26, -0.27, 0.17, 0.87
)
var biases = SIMD[DType.float64, 4](2, 3, 0.5)

var outputs = SIMD[DType.float64, 4](0, 0, 0)
for i in range(weights.dim(0)):
    for j in range(weights.dim(1)):
        outputs[i] += inputs[i] * weights[i][j]
    outputs[i] += biases[i]

print(outputs)

@linear linear bot closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

4 participants