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

Playground stops evaluating cells when a simple generic is defined #6

Closed
afarnham opened this issue May 3, 2023 · 2 comments
Closed
Labels
mojo-repo Tag all issues with this label

Comments

@afarnham
Copy link

afarnham commented May 3, 2023

Bug Description

When I enter the following in a cell:

struct MyGenericType[Type: AnyType]:
    var value: Type
    
    fn __init__(self&, v: Type):
        self.value = v

All cells in my notebook stop evaluating. I would expect the cells to continue evaluating.

However, if I copy the cell from the HelloMojo notebook that defines a generic Array into a fresh notebook, the cells evaluate fine. I do not understand why the simple example fails.

Steps to Reproduce

  1. Create a new untitled notebook
  2. Paste the following into the first cell
struct MyGenericType[Type: AnyType]:
    var value: Type
    
    fn __init__(self&, v: Type):
        self.value = v
  1. Attempt to evaluate the cell, or any other cells you add to the notebook

Context

11:freezer:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
10:pids:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
9:hugetlb:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
8:net_cls,net_prio:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
7:blkio:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
6:cpu,cpuacct:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
5:cpuset:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
4:devices:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
3:perf_event:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
2:memory:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
1:name=systemd:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod9eded8d2_162f_4b93_aa8d_4d5278d1fdd8.slice/cri-containerd-72c619273dbff076e50143c56e8a537d3ae76e7c1b2d7375d02c6627d4eca2c0.scope
@goldiegadde goldiegadde added playground label to tag playground environment related issues. and removed playground label to tag playground environment related issues. labels May 3, 2023
@nmsmith
Copy link
Contributor

nmsmith commented May 4, 2023

I'm experiencing the same problem!

@lattner
Copy link
Collaborator

lattner commented May 5, 2023

I fixed this in main and it will be in an update (check the changelog), thanks for the report!

@lattner lattner closed this as completed May 5, 2023
JoeLoser pushed a commit to JoeLoser/mojo that referenced this issue Mar 28, 2024
…ps (#29659)

1) In string, don't have the move ctor copy the buffer.
2) Use owned and transfer in a few places in dict.
3) remove workaround for #27792 from optional
4) Use constrained instead of kgen.param.assert in Reference
5) Add an "emplace_ref_unsafe" function (which really should be a
   method on reference, sigh) to do "operator new"
6) Fix a bug in Variant by using references instead
   of bitcopying the _impl data just to get an address. This addresses
   the fixme in #27657.
7) Use _call_correct_deleter() in Variant to reduce duplication
8) other minor tidying.

Step modularml#6 fixes #29358, which is a pretty serious bug.

modular-orig-commit: 9cf99e8c72f69f051b71b98da7fcb357f52180f7
JoeLoser pushed a commit to JoeLoser/mojo that referenced this issue Mar 28, 2024
…2290)

This continues to remove the pop operations from the dtype checks
without getting recursive elaborator errors

E.g

```
no work left, no deferred search, and no recursion?
UNREACHABLE executed at /Users/abduld/code/modular/KGEN/lib/Elaborator/Elaborator.cpp:2703!
PLEASE submit a bug report to [Internal Link] and include the crash backtrace.
 #0 0x0000000102c4ca08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/abduld/code/modular/.derived/build-release/bin/mojo-prime-package-cache+0x1000c4a08)
 #1 0x0000000102c4ab68 llvm::sys::RunSignalHandlers() (/Users/abduld/code/modular/.derived/build-release/bin/mojo-prime-package-cache+0x1000c2b68)
 modularml#2 0x0000000102c4d0a8 SignalHandler(int) (/Users/abduld/code/modular/.derived/build-release/bin/mojo-prime-package-cache+0x1000c50a8)
 modularml#3 0x00000001880e02a4 (/usr/lib/system/libsystem_platform.dylib+0x1803fc2a4)
 modularml#4 0x00000001880b1cec (/usr/lib/system/libsystem_pthread.dylib+0x1803cdcec)
 modularml#5 0x0000000187feb2c8 (/usr/lib/system/libsystem_c.dylib+0x1803072c8)
 modularml#6 0x0000000102be03a0 llvm::install_out_of_memory_new_handler() (/Users/abduld/code/modular/.derived/build-release/bin/mojo-prime-package-cache+0x1000583a0)
```

modular-orig-commit: ebb7c424801291198503fde0ebdd6fd28da8f2e9
@ematejska ematejska added the mojo-repo Tag all issues with this label label May 7, 2024
modularbot pushed a commit that referenced this issue May 29, 2024
This PR introduces nondeterminism into the testsuite. `test_dict.mojo`
nondeterministically fails with

```
[M] ➜  modular git:(1853f9d3e9) mojo /Users/jeff/Documents/modular/******/test/stdlib/collections/test_dict.mojo
Test test_basic ...PASS
Test test_multiple_resizes ...PASS
Test test_big_dict ...PASS
Test test_compact ...PASS
Test test_compact_with_elements ...PASS
Test test_pop_default ...PASS
Test test_key_error ...PASS
Test test_iter ...PASS
Test test_iter_keys ...PASS
Test test_iter_values ...PASS
Test test_iter_values_mut ...PASS
Test test_iter_items ...PASS
Test test_dict_copy ...PASS
Test test_dict_copy_add_new_item ...PASS
Test test_dict_copy_delete_original ...PASS
Test test_dict_copy_calls_copy_constructor ...PASS
Test test_dict_update_nominal ...PASS
Test test_dict_update_empty_origin ...PASS
Test test_dict_update_empty_new ...PASS
Test test_mojo_issue_1729 ...PASS
Test test dict or ...PASS
Test test dict popteim ...get: wrong variant type
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 /Users/jeff/Documents/modular/******/test/stdlib/collections/test_dict.mojo
 #0 0x00000001043a10b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c90b0)
 #1 0x000000010439f210 llvm::sys::RunSignalHandlers() (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c7210)
 #2 0x00000001043a1750 SignalHandler(int) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c9750)
 #3 0x00000001ab1b2a24 (/usr/lib/system/libsystem_platform.dylib+0x18042ea24)
 #4 0xffff8002a81b8510
 #5 0x00000001047c1608 M::KGEN::ExecutionEngine::runProgram(llvm::StringRef, llvm::StringRef, llvm::function_ref<M::ErrorOrSuccess (void*)>) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1004e9608)
 #6 0x00000001042f8270 executeMain(mlir::ModuleOp, mlir::SymbolTable const&, M::KGEN::ExecutionEngine*, M::LLCL::Runtime&, llvm::ArrayRef<char const*>) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x100020270)
 #7 0x00000001042f7cb8 run(M::State const&) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x10001fcb8)
 #8 0x00000001042df774 main (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x100007774)
 #9 0x00000001aae2bf28
[1]    44318 trace trap  mojo
```

MODULAR_ORIG_COMMIT_REV_ID: ee1c665669902106df680fe6c6d2599897665ff5
modularbot pushed a commit that referenced this issue Jun 7, 2024
This PR introduces nondeterminism into the testsuite. `test_dict.mojo`
nondeterministically fails with

```
[M] ➜  modular git:(1853f9d3e9) mojo /Users/jeff/Documents/modular/******/test/stdlib/collections/test_dict.mojo
Test test_basic ...PASS
Test test_multiple_resizes ...PASS
Test test_big_dict ...PASS
Test test_compact ...PASS
Test test_compact_with_elements ...PASS
Test test_pop_default ...PASS
Test test_key_error ...PASS
Test test_iter ...PASS
Test test_iter_keys ...PASS
Test test_iter_values ...PASS
Test test_iter_values_mut ...PASS
Test test_iter_items ...PASS
Test test_dict_copy ...PASS
Test test_dict_copy_add_new_item ...PASS
Test test_dict_copy_delete_original ...PASS
Test test_dict_copy_calls_copy_constructor ...PASS
Test test_dict_update_nominal ...PASS
Test test_dict_update_empty_origin ...PASS
Test test_dict_update_empty_new ...PASS
Test test_mojo_issue_1729 ...PASS
Test test dict or ...PASS
Test test dict popteim ...get: wrong variant type
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 /Users/jeff/Documents/modular/******/test/stdlib/collections/test_dict.mojo
 #0 0x00000001043a10b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c90b0)
 #1 0x000000010439f210 llvm::sys::RunSignalHandlers() (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c7210)
 #2 0x00000001043a1750 SignalHandler(int) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c9750)
 #3 0x00000001ab1b2a24 (/usr/lib/system/libsystem_platform.dylib+0x18042ea24)
 #4 0xffff8002a81b8510
 #5 0x00000001047c1608 M::KGEN::ExecutionEngine::runProgram(llvm::StringRef, llvm::StringRef, llvm::function_ref<M::ErrorOrSuccess (void*)>) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1004e9608)
 #6 0x00000001042f8270 executeMain(mlir::ModuleOp, mlir::SymbolTable const&, M::KGEN::ExecutionEngine*, M::LLCL::Runtime&, llvm::ArrayRef<char const*>) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x100020270)
 #7 0x00000001042f7cb8 run(M::State const&) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x10001fcb8)
 #8 0x00000001042df774 main (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x100007774)
 #9 0x00000001aae2bf28
[1]    44318 trace trap  mojo
```

MODULAR_ORIG_COMMIT_REV_ID: ee1c665669902106df680fe6c6d2599897665ff5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

5 participants