-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mojo oss release 2024 04 05 210926699 fixup #1
Mojo oss release 2024 04 05 210926699 fixup #1
Conversation
…on. (#36110) modular-orig-commit: 038e34dca15cff2a2bdb22285f6d90628737a66d
…150) This just cleans up a few more of these in builtin_list. modular-orig-commit: 0f88978e8005a0e0aae4c2e279b57cbca8b101c7
This changes substituteMLIRMagic to include the trait type in the expanded string for a value of trait type in a KGEN type context. This makes it easier and less error prone to work with trait values. If there is a reason to get the raw type without a preceding type, then you can use the unary plus hack like for other attribute values. modular-orig-commit: 09c8a037b73d016d139e8391bb37d31c943ed9b4
The semantics of this are not well defined for mojo right now, so it's cleaner to just disallow it. We can loosen this up when we have cleaner semantics around entry points in packages. Closes [Internal Link] modular-orig-commit: 3203283b41bfd984cd183ba1a314c0c3ba13925d
This was required originally because of issues related to packaging, but with the removal of separate package codegen, this is no longer necessary. Closes #24957 modular-orig-commit: 79be2c2c74f2aefac95625115a8b7baf291c25ad
…6069) This provides a more familiar way to enable full debugging that matches many other languages. Closes #24171 modular-orig-commit: 7d9038b935bbf86b775237a33b0cb294798200af
We only need a single one of these, so just remove the div_ceil function in place of the ceildiv one (since the ceildiv is what it's called in Python). Closes #33323 modular-orig-commit: 627e5eef1aa20d7c03f0330ad608b2dbbe24a945
The logic was incorrect if there was a remainder from C.cols % nelts modular-orig-commit: 347157c2401cdacd24f97f1a42027245438e168d
Update the changelog to reflect #36207, since it represents a slight change in the `mojo` tool's behavior. modular-orig-commit: 0e954f4d4768c3674dfd4f8989f67050bec140cf
Maybe that wasn't the doc you were looking for. modular-orig-commit: fb7d62c22be4e0edf05c49e4624c9fa4a1f880f8
modular-orig-commit: 44d3a3560edfbd4510e7a906d895a5b01c04b606
This is split off of #33595 modular-orig-commit: d745e5673d768ab862661f0ada2adb91f34e81e2
… source (#35595) The REPL is doing dirty tricks with variables, turning them into heap allocations and tracking them in indirect structs. However, CheckLifetimes is onto its tricks, which causes it to reject these as incorrect values. The right solution is to make more invasive changes to the REPL, but that isn't in the short term plans. Workaround this by introducing a horrible hack (tm) op `RefFromPointerUntrackedOp` that creates a reference that isn't tracked by CheckLifetimes. This pokes a hole in our nice reference system which makes me very sad. A comment saying "don't use this" will prevent other people from using this for other things ... right??? --------- Co-authored-by: Chris Lattner <clattner@nondot.org> modular-orig-commit: 7a6b7339522d2657f72d7e8a3a5b51e4d299167f
This patch is a big step towards enabling VariadicPack to model packs with a non-AnyType bound (e.g. all members must be Stringable). It expands `VariadicPack` with a new `element_trait` member that indicates what all the elements are, and teaches the parser to pass down the element type. The magic enabling this is support for metatype bound type expressions which is almost working, but not quite there yet. As such, this is another step, but isn't enough to declare success, which is why the integration test isn't using it yet. :-/ modular-orig-commit: d45b597eef0f58fc20770c2b7ec860216e9ecc6c
This teaches `canConvertWithRebind` that it is safe to rebind an parametric expression of type `AnyTrait[SomeTrait]` to `SomeTrait` which gets us in the parametric types game, and eliminates some grunge from `VariadicPack` implementation. modular-orig-commit: c34dc6183d5853c6960e92ff538256aa3e511f29
Update the tests to make use of the variadic initializer of `List`. Upstream commit: [Internal Link] modular-orig-commit: eb3d9197014a73fef737574578429b68bed10808
This was introduced as part of the previous attempt at managing autotuning (parameter-based variadic construction to feed into `kgen.param.fork`). This had one use in the standard library, but it is redundant with `pop.variadic.size`, so it's been replaced. modular-orig-commit: 2d1553790e03d2cc2ee5e24fe840b71728db155f
This fixes a merge conflict due to the change from VariadicPack working with general element types. modular-orig-commit: f62bb0a10e06107271ebf4dfa9e2db968bee4333
To do this, some dunder methods needed to be changed so that they don't raise (but abort instead) until `raises`-ness of functions can be parametric. This patch also adds a bit of glue to allow `Dict` to be used conveniently instead of a Python dictionary. modular-orig-commit: 612718161d13c7a074e0f1f98962788b8b0828da
The two methods `removeprefix` and `removesuffix` are present in python. See the docs: * https://docs.python.org/3/library/stdtypes.html#str.removeprefix * https://docs.python.org/3/library/stdtypes.html#str.removesuffix Both were introduced in python 3.9. The documentation was added, the arguments were made positional-only like in CPython. Unit tests were added in the corresponding module. The docstrings were taken from the python documentation. Note: - Had minor formatting fixes to please the internal doc-string validation since that is not yet enabled on the public CI. Upstream commit: [Internal Link] modular-orig-commit: 16a471fe050c17a236f5086adb092622aa7ac0ff
This enables users to conveniently set elements of Python lists and dicts, among other things. modular-orig-commit: 815d912bf5ff0e726abdfc0868d374eee3972ab2
…s/result (#36391) The LSP was using `->` as a heuristic for the separation between the arguments and results of a function signature, which isn't correct in the presence of functional types. This PR fixes the rendering to properly track the offset of a return, to ensure the hover is always right. Closes [Internal Link] Closes [Internal Link] modular-orig-commit: ed82e2e607cda9c8d7a018d0d545a453443962c3
…6408) This PR fixes the detection and processing of argument conventions, allowing properly handling and display of inout/owned/borrowed arguments (also respecting the defaults for fn vs def). Closes [Internal Link] modular-orig-commit: 83af6de2ec5e2091b3309ef12e5add3eaba2bb34
Closes [Internal Link] This also enables the self test on mac, which passes in [Internal Link] modular-orig-commit: 05cb1a0f5b903d09186a2e48554237d03de0f17b
There was an assumption that if a literal starts with `0` and is at least 3 characters long, it has to be because it started with `0b`, `0x`, etc., and hence was safe to strip off 2 characters. When you do this with `0__`, you end up with `_`, which after filtering underscores, is an empty string, which can't be parsed as an integer, causing an assertion error. Instead, the first two characters only if it's one of the prefixes we expect. Fixes modularml#1913. modular-orig-commit: 75cce9ad8716af3f950a5e36fa855a343f65ba16
This gives the current underlying value for the atomic. Closes #36470 modular-orig-commit: d5c0d002492b896d91600e8af6306301f1219a80
This enhances type checking of type parameter expressions of AnyTrait type to look through downcasts of the type itself and allows downcast from a value of `AnyTrait[SomeTrait]` to `SomeTrait`. This is enough to enable us to type check the fancy dependently typed `each` method on `VariadicPack` which makes VariadicPack useful for non-AnyType trait requirements as shown in the integration test!!! This bumps up against a bug in the KGEN ParameterVerifier. I believe the fix is simple, but am not 100% confident about it, so I temporarily disabled it and filed #36583 to discuss this. modular-orig-commit: 816c623595bce4a995afc795bf5fd551c0c83900
This was previously removed, but is actually used by our manual and also is generally useful. Since `Dict` can now be used by the interop, implementing it is trivial. modular-orig-commit: cd0cc86e047f4e49c57969942132f9dda03f2e4f
modular-orig-commit: ec6fa3cea82422f85f5be7f08f0d93f3222ea1d1
To make it easier to create an empty python list. modular-orig-commit: ab43b2587bb32db7195a8f45cafb71279fb7e35a
`PythonObject` already implements the logic to create a Python `None`, so there this method can just simply delegate. The patch also adds a test case for this. modular-orig-commit: 629355fcfd56b1dba249550c894193f69f71891c
This change fixes following bug: [Internal Link] Upstream commit: [Internal Link] modular-orig-commit: ab9ccb453b1c928fde1d8ac69c382d2dfa925a6b
This new dictionary type is a wrapper over `Dict`, specializing on `String` keys. In a subsequent patch, this type will be used by the parser to pass variadic keyword arguments that are declared with `owned` ownership semantics. modular-orig-commit: ed73c202fa15d38f543f1baee525635b6aa989b4
Add `list.pop(index)` API to the stdlib as requested by [Internal Link] This API should handle the same functionality as the Python `list.pop`. Unit tests includes: - popping both positive and negative index - making sure returned value is consistent - making sure list len is consistent Upstream commit: [Internal Link] modular-orig-commit: 2077b615fd49acdce1287ce587a21c8342f0da1d
Now that `List` has a `pop(index)` API, remove `pop_back()` from `List`. `pop()` without any arguments has the same semantics. Fix up the call sites internally in the standard library. While here, adjust `pop(index)` to consistently use `len(self)`. Add a changelog entry for the new API in `List` and the removal of `pop_back()`. modular-orig-commit: 76c8b15ac5c2dd2da879de4fd1f438dad3572c7d
We get type rebinds when metatypes are downcast - look through these to infer from the original type before mapping. In the example, we are allowed to infer that the argument has type `element_types[i]` even though the Reference type erased it down to `AnyType`. modular-orig-commit: 8212deaf37c4b83a75195a86ae08bb2b931d4997
Why an extra blank line inside a fenced code block causes our MD processor to lose its mind is another question, but it does, and this fixes the issue in this instance. modular-orig-commit: 785e243082cedb89a5e5d0719ca33205bef441c2
…keyword arguments (#36540) Instead of using a `Dict`, the parser will use a more specialized type for passing variadic keyword arguments into callees. The patch also simplifies some of the emission logic by moving `String` creation for the keys into ``OwnedKwargsDict`. modular-orig-commit: bc0bc6edced025903ee095fa5ca3bea248690e66
Change the tests to explicitly import what they use rather than using `from <module> import *`. Upstream commit: [Internal Link] modular-orig-commit: d7ad4220c1e478180d3e300b39f8ad815ffbd8a8
[Here](https://docs.python.org/3/library/stdtypes.html#dict.update) is the python documentation about this method. There should be another overload: `fn update(self, **kwargs: V)` which we can't do yet since it would only work with keys that are strings and we don't yet have conditional conformance (see [Internal Link] This is why we force the argument to be positional-only. If we allowed it to be passed by keyword, it would break when we will introduce the other overload of `Dict.update`. Upstream commit: [Internal Link] modular-orig-commit: d3fcf8609c6d97b4ea4d2bf866987d89e9e30a86
The `__init__ -> Self` is getting deprecated. Switch over to "normal" `__init__` constructors that accept `Self` as an `inout` argument instead within the `os` module. Upstream commit: [Internal Link] modular-orig-commit: 3382fe2636ae361e732a1b94a0c0dbdc4aef03a4
Just as the title says, it's a very common idiom in python, is even recommended by PEP8: https://peps.python.org/pep-0008/#programming-recommendations. Comparisons to singletons like `None` should always be done with is or is not, never the equality operators. Also, beware of writing if x when you really mean if x is not None – e.g. when testing whether a variable or argument that defaults to None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context! While the warning does not apply to Mojo, Python users are quite used to it and it's a small quality of life improvement which is inexpensive to support. Upstream commit: [Internal Link] modular-orig-commit: 0961d7b5804b574df61806b8c433471e72cfcd67
… (#36719) Disallow negative and invalid values in the shuffle mask value. Closes [Internal Link] modular-orig-commit: dfac330b52860cf4418851b31807bfac0ccac2c8
…6727) modular-orig-commit: acf071cdc4ebba1ce41a3a059b5a2ef2077d896f
Fixes [Internal Link] Upstream commit: [Internal Link] modular-orig-commit: 7654fad7242cdb9d88759558a1ba7ca360889144
This is the big one: `VariadicPack` is now ready to take on the heavy load for all non-register-passable packs, which notably includes `print` and `String.join`. This means deleting our old friend `_StringableTuple`, replacing the logic with stuff that is much simpler. These examples use capturing values, so switch the `VariadicPack.each` method to work with a capturing closure This patch fixes a ton of bugs, because variadic packs of memory-only type now work! modular-orig-commit: 436b86a7496642a6a8f4c4921ef7234436618123
Fixes [Internal Link] - Adds an `address_space` parameter to `Reference` - Wires `address_space` through `Reference` methods - Updates `_LITRef` helper to speak `AddressSpace` types instead of an MLIR type --------- Co-authored-by: Chris Lattner <clattner@nondot.org> modular-orig-commit: 887d6b06b1fa807fc4092fefafb627ed657bb524
modular-orig-commit: 1b22c60e8429217ec8f3e37a28e81f970a04a6c2
We goofed when adding backtick support and caused mblack to parse `!` incorrectly. Running mblack on the repo after making this change also caused a bunch of other files to need formatting, so this PR includes those as well. Fixes [Internal Link] modular-orig-commit: daad7e9267589460a01cdf9612d8d34134479de9
That playground is gone now. modular-orig-commit: 097e1bd349e1a181cf1526732d9f4f8ec0c3071a
This moves the testsuite off of `AnyRegType` packs and onto `AnyType` packs as an initial step to making `AnyRegType` packs invalid. modular-orig-commit: 79b5189ec41b113965c829837258680b9dcdbbec
Adding an AddressSpace parameter to AnyPointer to make it usable in GPU contexts. This change includes fixes to the Dict implementation that resolve compilation failures. Also, fixes to Mojo parser tests that are validating generated mlir that changed due to the addition of the AddressSpace parameter. Closes #31636 modular-orig-commit: 8ecb40292c2113cd19fc99c590910a0952b542c4
…(#36906) `AnyRegType` variadic packs are a legacy feature that predated traits (and possibly memory only types in general). We are unifying on a single consistent representation built around `VariadicPack`. This takes the step of banning the old `AnyRegType` form in the parser. That said, we still have a few uses of the old form in the tree, so it keeps them alive when explicitly declared "borrowed". This will allow us to work through removing/replacing these cases incrementally. modular-orig-commit: 8e7642b4396f704020adabf48c2e7dfb01ec6e9d
…s (#36908) To avoid bikeshedding on the topic and have a place to point users to whenever the discussion comes up. modular-orig-commit: d35bcddaea49e7fcaa4ec5ec3ef7f88aa7b3ca42
The `pop()` function got refactored after an internal sync, causing some issues. Separately, the `moveinit` function for `atomic` got duplicated during the internal sync. Remove the duplicate definitions so the `stdlib` can be packaged and work properly again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title does not conform to the '[<Project>] Title' format. Please update the PR title.
Typical [<Project>] values include:
[stdlib]
— indicates a change to the Mojo standard library code[docs]
— indicates a change to the documentation
It's okay to include multiple labels on a PR that affect multiple areas of work.
Thank you for contributing to Mojo!🔥
You can also use a tool like www.regex101.com to see why your PR title fails to conform. Use ^(Revert ")?(\[\S.*\]\s?)+\s+[a-zA-Z`].*
as the regex to test and Mojo oss release 2024 04 05 210926699 fixup
as the test string.
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) modularml#2 0x00000001043a1750 SignalHandler(int) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x1000c9750) modularml#3 0x00000001ab1b2a24 (/usr/lib/system/libsystem_platform.dylib+0x18042ea24) modularml#4 0xffff8002a81b8510 modularml#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) modularml#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) modularml#7 0x00000001042f7cb8 run(M::State const&) (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x10001fcb8) modularml#8 0x00000001042df774 main (/Users/jeff/Documents/modular/.derived/build-relwithdebinfo/bin/mojo+0x100007774) modularml#9 0x00000001aae2bf28 [1] 44318 trace trap mojo ``` MODULAR_ORIG_COMMIT_REV_ID: ee1c665669902106df680fe6c6d2599897665ff5
No description provided.