https://github.com/JuliaLang/julia

sort by:
Revision Author Date Message Commit Date
9374e49 allow external `AbstractInterpreter` to overload `throw`-call handling (#52498) By defining new `abstract_throw` interface, which allows external `AbstractInterpreter` to customize the behavior of `throw`-call handling just by overloading `abstract_throw` method. This is particularly useful for JET. 12 December 2023, 09:03:25 UTC
e39e77f Fix `unaliascopy(::SubArray)` with `indices` of `Array{<:CartesianIndex}` (#47779) This PR fixes the bug caused by the trimming trick. `Base.index_lengths` is not a proper tool to calculate the trimmed shape as `indices` might consume more than 1 dim. And we can avoid the unneeded "`repeat`" when we meet `Array{CartesianIndex{0}}` Test added. Close #47644. 11 December 2023, 23:12:18 UTC
b71523e combine reduce_empty methods for Union{} eltypes (#51948) With #49470, these can all be dispatched to the same method now, avoiding unnecessary code duplication for this case. 11 December 2023, 17:36:47 UTC
3c2c5ce jltypes: try to reduce duplicate objects in type parameters We have this fairly small global cache of objects, so try to de-duplicate some other global objects with it. 11 December 2023, 17:34:22 UTC
2deff4d ircode: deduplicate Strings during deserialize instead of waiting for codegen 11 December 2023, 17:26:36 UTC
8cf7598 Make `jl_write_coverage_data` dllexported again (#52456) Closes #52452 11 December 2023, 17:25:46 UTC
bb28222 better support threads in precompile and jl_task_wait_empty (#52445) Add a `nrunning` counter which identifies (when zero) when there is nothing running anymore. Allowing us to gate all tasks on all threads on reaching a quiescent state, not just thread 0. This should let us better support running precompile with threads (since we will be ensured that all of them are asleep in a consistent state before serialization tries to inspect the process state). We could additionally stop them afterwards to make sure there is no way for them to begin running, even if we forgot about some other event source, but that seems unnecessary paranoia for now. Note it is quite hard to encounter currently, as most places where precompile happens currently try to force the number of threads to 1. But this should become more relevant in the future as more threads are supported in more places. This also may help generally with being able to ensure the IO loop is running on at least one thread (as that is currently lacking in this PR and on master). And also help with being able to decide on a more advanced tree-wakeup strategy, as we start to track how many threads are in various states of running and sleeping, relative to the amount of work they find. Fixes #52435 11 December 2023, 17:25:11 UTC
7b54ae7 relax type signature for PipeBuffer to accept AbstractVector{UInt8} (#52459) Fixes #48585 11 December 2023, 17:17:48 UTC
3accfe8 Improve `sizehint!` docstring about `shrink` arg (#52226) See https://github.com/JuliaLang/julia/pull/51929#discussion_r1390444453. 11 December 2023, 17:16:48 UTC
456951f Export several genericmemory-related functions from C (#52475) The functionality of `jl_array_isassigned`, `jl_arrayref`, `jl_arrayset`, and `jl_arrayunset` has been moved to new functions, but those new functions aren't exported. This PR exports them. 11 December 2023, 13:32:26 UTC
69e9005 Fix typos (#52479) Fix typos 11 December 2023, 09:46:47 UTC
2fe4190 Reduce code duplication in `eigen(::AbstractMatrix)` methods (#52450) This also fixes the following: ```julia julia> D = Diagonal(Float16[1,2,4]) 3×3 Diagonal{Float16, Vector{Float16}}: 1.0 ⋅ ⋅ ⋅ 2.0 ⋅ ⋅ ⋅ 4.0 julia> eigen(Array(D)) # returns Float32 Eigen{Float32, Float32, Matrix{Float32}, Vector{Float32}} values: 3-element Vector{Float32}: 1.0 2.0 4.0 vectors: 3×3 Matrix{Float32}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 julia> eigen(D) # returns Float16 as expected Eigen{Float16, Float16, Matrix{Float16}, Vector{Float16}} values: 3-element Vector{Float16}: 1.0 2.0 4.0 vectors: 3×3 Matrix{Float16}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 ``` After this, ```julia julia> eigen(Array(D)) Eigen{Float16, Float16, Matrix{Float16}, Vector{Float16}} values: 3-element Vector{Float16}: 1.0 2.0 4.0 vectors: 3×3 Matrix{Float16}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 ``` 11 December 2023, 04:37:14 UTC
5e9cd58 Use optimised string search methods for substrings, too (#52424) Allow searching for ASCII chars in substrings to use memchr, and other similar optimisations. Previously, only String was special cased. 11 December 2023, 02:29:06 UTC
d90fa45 Fix minimum/maximum over dimensions with missing values (#35323) `v0 != v0` returns `missing` for missing values. Use the largest/smallest non-missing value to initialize the array. This is an inefficient approach. Faster alternatives would be to avoid using an initial value at all, and instead keep track of whether a value has been set in a separate mask; or to use `typemax`/`typemin` for types that support them. Fixes #35308. 10 December 2023, 15:45:21 UTC
e2a26aa use atomics in the write barrier slow path (#52463) Use atomics in the write-barrier slow-path to prevent duplicates in the remset. As discussed in https://github.com/JuliaLang/julia/issues/50419, setting the mark bit is idempotent, but updating page metadata in the mark phase is not. 10 December 2023, 14:27:08 UTC
84cfe04 add `wrap` function which is the safe counterpart to `unsafe_wrap`. (#52049) 09 December 2023, 21:38:11 UTC
abeb68f make `rationalize` default to use `Int` on `Irrational` (and `Real`) (#46656) Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 09 December 2023, 17:01:26 UTC
649982a [REPLCompletions] support method invalidation (#52448) 09 December 2023, 01:05:25 UTC
551b37a 🤖 Bump the Statistics stdlib from 04e5d89 to 68869af (#52431) Stdlib: Statistics URL: https://github.com/JuliaStats/Statistics.jl.git Stdlib branch: master Julia branch: jn/loading-stdlib-exts Old commit: 04e5d89 New commit: 68869af Julia version: 1.11.0-DEV Statistics version: 1.11.1(Does not match) Bump invoked by: @vtjnash Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: https://github.com/JuliaStats/Statistics.jl/compare/04e5d8916fae616f5ad328cf6a0b94cf883b8ba6...68869af06e8cdeb7aba1d5259de602da7328057f ``` $ git log --oneline 04e5d89..68869af 68869af Bump patch for version 1.11.1 89f5fc7 Create tagbot.yml dc844db CI: restore v1.9.4 to build matrix (#159) d0523ae relax test for mapreduce_empty (#156) d1c1c42 Drop support for v1.9 in CI (#157) bfc6326 Fix `quantile` with `Date` and `DateTime` (#153) b8ea3d2 Prevent overflow in `mean(::AbstractRange)` and relax type constraint. (#150) a88ae4f Document MATLAB behavior in `quantile` docstring (#152) 46290a0 Revert "Prepare standalone package, step 2 (#128)" (#148) 81a90af make SparseArrays a weak dependency (#134) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com> 08 December 2023, 19:41:58 UTC
9723de5 loading: support extensions for stdlibs (an implicit env) (#52428) Some groundwork for https://github.com/JuliaStats/Statistics.jl/pull/134 which is bumped (and thus tested) in #52431 that will be merged after this 08 December 2023, 16:34:05 UTC
bf6c31c docs: add notes about scratchspaces in depot (#52367) Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com> 08 December 2023, 14:46:55 UTC
3b9c39a Remove `Pkg` dependency from `SuiteSparse_jll` (#52441) This dependency seems to be superfluous, and `Pkg` brings lots of dependencies into the project (Downloads, LibGit2, etc.) which makes it hard to create leaner binary packages via `PackageCompiler` for projects that depend on `SuiteSparse_jll`. 08 December 2023, 14:37:11 UTC
5dfaef7 Limit REPL suggestions to modules from which name is exported/public (#52418) Close #52387 by implementing the suggestion in https://github.com/JuliaLang/julia/issues/52387#issuecomment-1839152721. After this, in a fresh session ```julia julia> Diagonal ERROR: UndefVarError: `Diagonal` not defined in `Main` Suggestion: check for spelling errors or missing imports. Hint: a global variable of this name also exists in LinearAlgebra. ``` 08 December 2023, 03:39:30 UTC
80ba457 `BLAS.geru!` added (#51951) Closes https://github.com/JuliaLang/LinearAlgebra.jl/issues/12. **PR Checklist** - [x] added BLAS.geru! function in stdlib/LinearAlgebra/src/blas.jl - [x] also added test cases for it in stdlib/LinearAlgebra/test/blas.jl --------- Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com> Co-authored-by: mikmoore <95002244+mikmoore@users.noreply.github.com> Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com> 08 December 2023, 03:33:30 UTC
cfc4289 improve exception type inference for core math functions (#52254) Continued from #52241. This PR focuses on improving exception type inference for core math functions by using new callsite `Base.@assume_effects` annnotation. 08 December 2023, 01:14:54 UTC
1f4b33a Rm outdated code to outline value-position GlobalRef/Expr (#52446) Since this code was written, we have adjusted the semantics of IRCode to disallow non-constant GlobalRefs or non-trivial Exprs in statement position. 08 December 2023, 01:04:43 UTC
1e20c9c sroa: Handle looking through chains of KeyValue instances (#52369) Addresses an outstanding todo from the KeyValue PR and allows (once all the PRs are merged), optimization when multiple ScopedValues are used `with(a=>1, b=>2)`, etc. To facilitate this, in addition to the sroa adjustment, the ScopedValue code is adjusted to unroll the PersistentDict creation so that the optimizer can see the full chain (we do not support loops in the optimizer). 08 December 2023, 01:02:18 UTC
727142a Specialize eps(::IEEEFloat) (#52087) `eps(::IEEEFloat)` can be made notably faster. I doubt this function appears in performance-critical places, but better is better and this new version is branch-free. ```julia-repl julia> using BenchmarkTools julia> x = randn(2^10); julia> @btime map(eps,$x); # v1.9.1 2.067 μs (1 allocation: 8.12 KiB) julia> @btime map(eps,$x); # this PR 613.095 ns (1 allocation: 8.12 KiB) ``` A couple probably-negligible caveats that arise from the use of floating point arithmetic in this implementation: - The previous version always returned Julia's canonical `NaN` when the result would be NaN. In this PR, the NaN payload depends on the payload behavior of the hardware and the input. - The result is vulnerable to flush-to-zero floating point environments, in which case subnormal results will be flushed to `zero(T)`. The usability of a subnormal result amidst flushing mode is questionable, as is the well-posed-ness of `eps`'s semantics in such a situation. *Note that the existing implementation has this same vulnerability (due to `ldexp`), though only when the input to `eps` is normal and the result would be subnormal (only with an input of zero or a subnormal is a correct subnormal output produced, assuming the flushing occurs during arithmetic but not storage).* Canonicalizing `NaN` would require a simple `ifelse` switch on the result, though I can't imagine we care. Guaranteeing a proper subnormal result in flush-to-zero mode may be more challenging (and may warrant a branch) and is only handled slightly more correctly by the preexisting implementation. I imagine that flushing breaks a lot more functions than just this one, anyway. --------- Co-authored-by: Oscar Smith <oscardssmith@gmail.com> 07 December 2023, 21:02:06 UTC
710bf90 Make type hashing `:total` (#52427) Since types can't really be deleted and the hash of a type is already being cached inside of the type object itself, it should be legal to mark the `ccall` retrieving that hash as `:total`, permitting hashing of types to be concretely evaluated. I'm unsure if the test I've added is good as written, or whether this should be done differently. --------- Co-authored-by: Sukera <Seelengrab@users.noreply.github.com> Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> 07 December 2023, 20:52:39 UTC
46ad1c1 support if cache has a mixture of depot and non-depot includes (#52346) 07 December 2023, 18:17:03 UTC
0ba0157 sroa: Lift restriction that all_same optimization must give SSAValue (#52338) This restriction has been in there since this code was added in #44557. Unfortunately, I can't tell from the commit history why this restriction was added. It's possible that it was trying to avoid putting things into statement position that were not allowed in the phi block, but we have cleaned that up since (#50308 and related), so let's see if this restriction is still required, since I was seeing some suboptimial optimization results because of this. --------- Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com> 07 December 2023, 17:06:31 UTC
79de5f3 Declare some LinearAlgebra types and functions to be public (#52420) 07 December 2023, 16:26:52 UTC
e5046b4 Bump LLVM to 15.0.7+10 to fix GC issue (#52405) 07 December 2023, 16:21:38 UTC
067e02e Optimize `sort!` for AbstractArray (#52278) - Use `foreach` to union-split on dim rather than using dynamic dispatch. This is reasonable because it is unrolling to a finite set with size equal to `ndims` (e.g. 2) For high dimension arrays, this may still use dynamic dispatch (which is okay!) - When `dims != 0`, we're sorting slices with non-one step size. These are slow to sort so for large inputs copy to a contiguous array, sort that, and copy back. - For very short inputs, don't even allocate a scratch space. 07 December 2023, 15:02:13 UTC
b0abf95 Add `shuffle!` algorithm specialized for `AbstractArray{Bool}` (#52133) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> Co-authored-by: Denis Barucic <barucic.d@gmail.com> 07 December 2023, 14:54:05 UTC
431964f Remove the GMP.round function (#52319) 07 December 2023, 14:27:02 UTC
39ccdb2 Bunchkaufman- and LU-decomposition based generalized eigenvalues and eigenvectors (#50471) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> 07 December 2023, 11:21:05 UTC
9a0d209 Use IndexStyle in `diagind` to optionally return a range of `CartesianIndex`es (#52115) 07 December 2023, 11:06:31 UTC
71ee30f Expand geqp3! docs and replace Vectors with Refs (#51555) 07 December 2023, 10:01:05 UTC
75fdd86 clarify at-views docstring (#52374) 07 December 2023, 09:07:57 UTC
fa69f9c Fix type check in poll_fd() exception handler (#52377) 07 December 2023, 03:38:34 UTC
83abbcd [REPLCompletions] improve `REPLInterpreter` effects of dict operations (#52347) This should allow more completions for cases involving dict operations. 07 December 2023, 03:22:24 UTC
c731edb irinterp: skip `nothing` statement when analyzing `:nothrow` and `:noub` (#52417) This commit makes irinterp skip `nothing` statements when looking through `:nothrow` and `:noub` flags of all statements. This is necessary since `nothing` can be inserted as a dummy node, e.g. to prevent CFG change by `finish_current_bb!`, without explicitly marking it as `IR_FLAG_NOTHROW`. Alternatively, rather than altering irinterp, it might be better to mark `IR_FLAG_NOTHROW` (and maybe even `IR_FLAG_EFFECT_FREE` and other flags too) where those `nothing` statements are inserted. But I wasn't confident that this would address all scenarios or if it's the best way to go, so this commit opts for the previously mentioned symptomatic approach. 07 December 2023, 01:57:47 UTC
bdbee27 effects: support callsite `@assume_effects` annotation (#52400) 06 December 2023, 22:06:48 UTC
856e112 channels: fix memory ordering violation in iterate (#52407) Channel `iterate` calls might miss trailing items without this patch. I have not seen proof of this reaching a failure, but we do appear to be missing this ordering specification in visual review. Should not make a difference to generated code on x86, which already has TSO guaranteed, but may alter optimizations and other CPUs with weaker memory orderings. 06 December 2023, 15:35:44 UTC
3aa943b Sort exported names from LinearAlgebra [nfc] (#52419) 06 December 2023, 15:24:51 UTC
e2af398 add a test for page utilization metric (#52411) 06 December 2023, 15:12:40 UTC
627210d Return of the `tilebufsize` (#52422) See https://github.com/JuliaLang/julia/pull/52298#discussion_r1417407376. 06 December 2023, 14:36:51 UTC
dbb797f add two-arg `@macroexpand[1]` (#52416) So that we can provide a module context to evaluate in. This is more aligned with the design of `@eval` and `Meta.@lower`. 06 December 2023, 14:31:35 UTC
fd9d3c0 ircode: fix regression (crash) from Memory{T} PR (#52409) The offset should be in elements not bytes. 06 December 2023, 14:15:44 UTC
cfcc043 Aggressive constprop in matvecmul and matmatmul (#51961) 06 December 2023, 14:08:22 UTC
6a1df3d Review annotations and test for allocations in generic matmatmul (#52298) 06 December 2023, 11:20:33 UTC
b5abac4 delete unused code from simplevector (#52412) Circa #45062 and #46975 06 December 2023, 05:12:22 UTC
a948e6d Fix completion hint for sub/superscripts (#52402) Fix #52376 The completion hint starting offset was not computed considering the case where the input and the completion do not share the same prefix, which happens when completing into a subscript or a superscript. This fixes that by iteratively going through the characters of the hint until reaching that which marks the end of the input. 06 December 2023, 05:10:09 UTC
f96585b reflection: refactor `@assume_effects` implementation (#52399) I am working on implementing a support for callsite `@assume_effects` annotation, and this update is part of the preparation for that goal. Along this, I've modified the API from `pushmeta!(::Expr, ::Symbol, args...)` to `pushmeta!(::Expr, ::Union{Symbol,Expr})`. This change isn't breaking as long as the `args` are empty, which is the case for most use cases (actually there is only one usage of `pushmeta!` with non-empty `args` within Julia base). I've verified on JuliaHub, and there don't appear to be any packages using `pushmeta!` with non-empty `args`, so there shouldn't be any (big) issues. 06 December 2023, 05:03:06 UTC
2949dd5 bugfix: make sure symbol loading from Base.gc_page_utilization_data works on linux (#52406) Co-authored-by: Jameson Nash <vtjnash@gmail.com> 05 December 2023, 20:40:31 UTC
4209474 Add `Docs.hasdoc` function (#52139) Add helper method `Docs.hasdoc` to facilitate automated testing of whether documentation exists. Closes: https://github.com/JuliaLang/julia/issues/51174. Co-authored-by: Steven G. Johnson <stevenj@mit.edu> 05 December 2023, 18:24:32 UTC
fd41af5 Add logdet and logabsdet methods for Symmetric/Hermitian matrices (#51930) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> 05 December 2023, 17:10:25 UTC
e26c257 GC scheduler refinements (#52294) Supersedes https://github.com/JuliaLang/julia/pull/51061 and https://github.com/JuliaLang/julia/pull/51414. Still needs more perf analysis. 05 December 2023, 16:47:15 UTC
2ef056a Simplify triangular multiplication code slightly (#52393) 05 December 2023, 15:39:51 UTC
dcf08be Declare hermitian/hermitian_type to be public (#52388) Similarly, for `symmetric/symmetric_type`. These are meant to be specialized by custom types, so these should not be marked internal to `LinearAlgebra`. 05 December 2023, 15:03:12 UTC
e0d9cb2 Update Documenter 0.27.23 => 1.2.1 (#47105) Currently mainly to test a few things on CI here, but will update this to an actual PR once 0.28.0 is out. --------- Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 05 December 2023, 14:55:24 UTC
d0e7ec0 Adjoint for vectors may use trailing axes of the parent (#52379) Close #52373, or at least the part that may be addressed here. After this, the first axis for an `Adjoint(parent::AbstractVector)` will be the second axis of the `parent`. This will change the type of the axis where the parent array type specializes `axes(A, d)`. In the short term, this would improve type-stability in cases such as ```julia julia> A = OffsetArray([1,2], 2); julia> @code_typed axes(A')[1] CodeInfo( 1 ─ %1 = $(Expr(:boundscheck))::Bool │ %2 = Base.getfield(t, i, %1)::OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}} └── return %2 ) => OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}} ``` where the result is now concretely inferred instead of being a small `Union`. In principle, with https://github.com/JuliaArrays/StaticArrays.jl/pull/916, this would make the axes of the adjoint of a `StaticVector` statically sized. 05 December 2023, 14:54:41 UTC
28b252a Remove confusing `::AdjointAbsVec * ::AdjointAbsVec` methods (#52401) These methods presumably exist to throw an error at the top-level, rather than after the arrays have been unwrapped. However, the error message is confusingly incorrect: ```julia julia> x = [1]'; julia> x isa Adjoint{T, <:AbstractVector} where T true julia> x * x ERROR: MethodError: no method matching *(::LinearAlgebra.Adjoint{Int64, Vector{Int64}}, ::LinearAlgebra.Adjoint{Int64, Vector{Int64}}) Closest candidates are: *(::LinearAlgebra.Adjoint{T, <:AbstractVector} where T, ::LinearAlgebra.Adjoint{T, <:AbstractVector} where T) @ LinearAlgebra ~/packages/julias/julia-latest/share/julia/stdlib/v1.11/LinearAlgebra/src/adjtrans.jl:481 *(::LinearAlgebra.Adjoint{T, <:AbstractVector} where T, ::AbstractMatrix) @ LinearAlgebra ~/packages/julias/julia-latest/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:87 *(::AbstractMatrix, ::AbstractMatrix, ::Number, ::Number) @ LinearAlgebra ~/packages/julias/julia-latest/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:1084 ... Stacktrace: [1] *(u::LinearAlgebra.Adjoint{Int64, Vector{Int64}}, v::LinearAlgebra.Adjoint{Int64, Vector{Int64}}) @ LinearAlgebra ~/packages/julias/julia-latest/share/julia/stdlib/v1.11/LinearAlgebra/src/adjtrans.jl:481 [2] top-level scope @ REPL[2]:1 ``` Note that the first suggested method is the one that we're hitting, except this is throwing a `MethodError` again, which makes it seem like there is no match. We may potentially change this from a `MethodError` to a different type (perhaps `ArgumentError`), but perhaps this method is not necessary anyway? After this PR, we obtain ```julia julia> x * x ERROR: MethodError: no method matching *(::Vector{Int64}, ::Vector{Int64}) Closest candidates are: *(::Any, ::Any, ::Any, ::Any...) @ Base operators.jl:595 *(::Dates.Period, ::AbstractArray) @ Dates ~/julia/usr/share/julia/stdlib/v1.11/Dates/src/periods.jl:93 *(::Number, ::AbstractArray) @ Base arraymath.jl:21 ... Stacktrace: [1] *(x::Adjoint{Int64, Vector{Int64}}, A::Adjoint{Int64, Vector{Int64}}) @ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:87 [2] top-level scope @ REPL[9]:1 ``` This makes it clear that the real issue is that we can't multiply two vectors. 05 December 2023, 14:54:21 UTC
9c6fec1 Add Zulip to README (#52403) As [suggested](https://github.com/JuliaLang/www.julialang.org/pull/1982#issuecomment-1839772373) by @jariji Placing it above Slack because - Zulip does not eat messages (the slackhole is a drain of community resources, esp. on the #helpdesk channel) - Zulip is FOSS - Zulip is a wee bit more feature complete (this is debatable, but I hold it to be true) 05 December 2023, 14:39:06 UTC
7055644 Unalias off-diagonals in Tridiagonal constructor (#51763) 05 December 2023, 12:59:58 UTC
c1ca0d3 Generalize Diagonal * AdjOrTransAbsMat to arbitrary element types (#52389) 05 December 2023, 10:59:48 UTC
8d0eec9 Implement `cbrt(A::AbstractMatrix{<:Real})` (#50661) Co-authored-by: Dilum Aluthge <dilum@aluthge.com> Co-authored-by: Steven G. Johnson <stevenj@mit.edu> 05 December 2023, 10:37:42 UTC
53f1eb8 bugfix for dot of Hermitian{noncommutative} (#52333) Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de> 05 December 2023, 10:26:21 UTC
150c1ad Add single-term multiplication for `AbstractQ` on v1.10 and above (#52342) 05 December 2023, 10:05:31 UTC
0a4b810 functionality to expose page utilization at the julia level (#52390) --------- Co-authored-by: Valentin Churavy <vchuravy@users.noreply.github.com> 04 December 2023, 20:29:30 UTC
bb7091c Speed up `first` and `only` for various types (#52296) 04 December 2023, 14:58:00 UTC
f761860 Export `jl_alloc_array_nd`, re-add and export convenience wrappers (#52248) This is used in an example here in the docs https://docs.julialang.org/en/v1.11-dev/manual/embedding/#Multidimensional-Arrays and needed to adapt to the removed `jl_alloc_array_2d` (#51319). 04 December 2023, 14:15:02 UTC
e280387 [LAPACK] Interface lacpy! and add a Julia version copytrito! (#51909) The PR adds a function `lacpy!` to easily copy a triangular part of a square or rectangular dense matrix. 04 December 2023, 13:10:54 UTC
b69398a Integer matrix exponentiation in schurpow (#51992) This improves type-inference by avoiding recursion, as the `A^p` method calls `schurpow` if `p` is a float. After this, the result of `schurpow` is inferred as a small `Union`: ```julia julia> @inferred Union{Matrix{ComplexF64}, Matrix{Float64}} LinearAlgebra.schurpow([1.0 2; 3 4], 2.0) 2×2 Matrix{Float64}: 7.0 10.0 15.0 22.0 ``` One concern here might be that for large `p`, the `A^Int(p)` computation might be expensive by repeated multiplication, as opposed to diagonalization. However, this may only be the case for really large `p`, which may not be commonly encountered. I've added a test, but I'm unsure if `schurpow` is deemed to be an internal function, and this test is unwise. Unfortunately, the return type of `A^p` isn't concretely inferred yet as there are too many possible types that are returned, so I couldn't test for that. 04 December 2023, 03:08:55 UTC
fb5f7ad Fix docs link to package tests docs (#52384) Since https://github.com/JuliaLang/julia/pull/52102 these links to the Pkg.jl docs are dead. This should point them to the new location in the Julia docs. There is a reference in CONTRIBUTING.md that should change as well, but maybe not until a Julia version with these changes is released: https://github.com/JuliaLang/julia/blob/3e4b38684e38a015446253f5752ee9cf840f50cc/CONTRIBUTING.md?plain=1#L17 04 December 2023, 00:34:19 UTC
3e4b386 add some comments about `ScopedValue` implementation (#52372) 03 December 2023, 04:15:57 UTC
641f717 make custom log macros work (#52359) 02 December 2023, 14:36:18 UTC
aef528d nfc: remove duplicate variable declaration (#52360) 01 December 2023, 03:51:11 UTC
58c1d51 [REPLCompletions] fix #52099 by adjusting effects of `HAMT` methods (#52331) After looking into #52099, I discovered that it has the same root cause as #51548. Essentially, when a method that's not `!effect_free` is applied to a `Const` value concretized by the `REPLInterpreter`'s aggressive inference, since the `!effect_free` method will not be concretized, it will eventually lead to the `Const` representing unexpected object being returned. This commit tries to fix the specific problem reported in #52099 by enhancing the effects of `Base.HAMT` methods, so they're concrete-evaled. Admittedly, this is more of a quick fix than a complete solution, and not the best one, but it was the simplest. A better solution might involve implementing EA's handling of `Memory`-objects that allows the compiler to automatically prove `:effect_free` in more scenarios. But this would need a bigger overhaul, so I plan to tackle it in another PR. 01 December 2023, 00:12:35 UTC
bac3ba5 Fix oracle count violation in sroa_pass! (#52336) 30 November 2023, 03:12:47 UTC
fd67cb2 incorporate upstream fixes to crc32c.c assembly (#52326) These are a response to [this comment](https://stackoverflow.com/questions/17645167/implementing-sse-4-2s-crc32c-in-software/17646775#comment88832559_17646775) on StackOverflow: > Your asm constraints aren't strictly safe. A pointer in a `"r"` constraint does not imply that the pointed-to memory is also an input. You could just use memory operands (or the `_mm_crc32_u64` intrinsic), but if you want to force the addressing mode you can use a dummy memory operand like `asm("crc32 (%1),%0 " : "+r"(crc0) : "r"(next), "m" (*(const char (*)[24]) pStr) )`;. Inlining or LTO could break this. See [at&t asm inline c++ problem](https://stackoverflow.com/posts/comments/81680441) (which needs an update: pointer-to-array is cleaner than a struct with a flexible array member). The existing test coverage wasn't enough to fully exercise Adler's code, so I added another test. Closes #52325 29 November 2023, 21:13:04 UTC
9bd2432 cfg_simplify: Fix bug in my bugfix (#52337) The fix in #52323 was not quite correct. Fix that and adjust the test to more accurately reflect the actual issue. 29 November 2023, 05:06:41 UTC
de525af extract common code to create a dummy `IRCode` into a utility function (#52329) Simplifies test code. xref: <https://github.com/JuliaLang/julia/pull/52323#pullrequestreview-1751907258>. 28 November 2023, 17:38:41 UTC
68b4587 Remove no-op specializations of `only` [NFC] (#52328) An easily merged subset of @matthias314's #52296, separated from that PR at @mkitti's suggestion. I kept the low-but-nonzero value specializations for Tuple and Named tuple which offer better error messages. They may be removed with a future PR that improves the generic error message. To verify this is indeed a no-op ``` @code_llvm only(Ref(4)) @code_llvm only(Ref(nothing)) @code_llvm only('z') @code_llvm only((4,)) @code_llvm only((nothing,)) only((4,2)) @code_llvm only(Array{Int, 0}(undef)) @code_llvm only((;x=3)) only((;)) only((;x=2, y=4)) ``` Before ``` julia> @code_llvm only(Ref(4)) ; Function Signature: only(Base.RefValue{Int64}) ; @ iterators.jl:1563 within `only` define i64 @julia_only_2451({}* noundef nonnull align 8 dereferenceable(8) %"x::RefValue") #0 { top: ; ┌ @ refvalue.jl:59 within `getindex` ; │┌ @ Base.jl:49 within `getproperty` %0 = bitcast {}* %"x::RefValue" to i64* %.x = load i64, i64* %0, align 8 ; └└ ret i64 %.x } julia> @code_llvm only(Ref(nothing)) ; Function Signature: only(Base.RefValue{Nothing}) ; @ iterators.jl:1563 within `only` define void @julia_only_2519({}* noundef nonnull %"x::RefValue") #0 { top: ret void } julia> @code_llvm only('z') ; Function Signature: only(Char) ; @ iterators.jl:1565 within `only` define i32 @julia_only_2527(i32 zeroext %"x::Char") #0 { top: ret i32 %"x::Char" } julia> @code_llvm only((4,)) ; Function Signature: only(Tuple{Int64}) ; @ iterators.jl:1566 within `only` define i64 @julia_only_2529([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::Tuple") #0 { top: ; ┌ @ tuple.jl:31 within `getindex` %"x::Tuple[1]_ptr" = getelementptr inbounds [1 x i64], [1 x i64]* %"x::Tuple", i64 0, i64 0 ; └ %"x::Tuple[1]_ptr.unbox" = load i64, i64* %"x::Tuple[1]_ptr", align 8 ret i64 %"x::Tuple[1]_ptr.unbox" } julia> @code_llvm only((nothing,)) ; Function Signature: only(Tuple{Nothing}) ; @ iterators.jl:1566 within `only` define void @julia_only_2532() #0 { top: ret void } julia> only((4,2)) ERROR: ArgumentError: Tuple contains 2 elements, must contain exactly 1 element Stacktrace: [1] only(x::Tuple{Int64, Int64}) @ Base.Iterators ./iterators.jl:1567 [2] top-level scope @ REPL[6]:1 julia> @code_llvm only(Array{Int, 0}(undef)) ; Function Signature: only(Array{Int64, 0}) ; @ iterators.jl:1570 within `only` define i64 @julia_only_2779({}* noundef nonnull align 8 dereferenceable(16) %"a::Array") #0 { top: ; ┌ @ abstractarray.jl:1314 within `getindex` ; │┌ @ abstractarray.jl:1343 within `_getindex` ; ││┌ @ essentials.jl:817 within `getindex` %0 = bitcast {}* %"a::Array" to i64** %1 = load i64*, i64** %0, align 8 %2 = load i64, i64* %1, align 8 ; └└└ ret i64 %2 } julia> @code_llvm only((;x=3)) ; Function Signature: only(NamedTuple{(:x,), Tuple{Int64}}) ; @ iterators.jl:1571 within `only` define i64 @julia_only_2794([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::NamedTuple") #0 { top: ; ┌ @ abstractarray.jl:469 within `first` ; │┌ @ namedtuple.jl:165 within `iterate` @ namedtuple.jl:165 %"x::NamedTuple.x_ptr" = getelementptr inbounds [1 x i64], [1 x i64]* %"x::NamedTuple", i64 0, i64 0 ; └└ %"x::NamedTuple.x_ptr.unbox" = load i64, i64* %"x::NamedTuple.x_ptr", align 8 ret i64 %"x::NamedTuple.x_ptr.unbox" } julia> only((;)) ERROR: ArgumentError: NamedTuple contains 0 elements, must contain exactly 1 element Stacktrace: [1] only(x::@NamedTuple{}) @ Base.Iterators ./iterators.jl:1572 [2] top-level scope @ REPL[9]:1 julia> only((;x=2, y=4)) ERROR: ArgumentError: NamedTuple contains 2 elements, must contain exactly 1 element Stacktrace: [1] only(x::@NamedTuple{x::Int64, y::Int64}) @ Base.Iterators ./iterators.jl:1572 [2] top-level scope @ REPL[10]:1 ``` After ``` julia> @code_llvm only(Ref(4)) ; Function Signature: only(Base.RefValue{Int64}) ; @ iterators.jl:1550 within `only` define i64 @julia_only_6821({}* noundef nonnull align 8 dereferenceable(8) %"x::RefValue") #0 { top: ; @ iterators.jl:1551 within `only` ; ┌ @ refpointer.jl:103 within `iterate` ; │┌ @ refvalue.jl:59 within `getindex` ; ││┌ @ Base.jl:49 within `getproperty` %0 = bitcast {}* %"x::RefValue" to i64* %.x = load i64, i64* %0, align 8 ; └└└ ; @ iterators.jl:1559 within `only` ret i64 %.x } julia> @code_llvm only(Ref(nothing)) ; Function Signature: only(Base.RefValue{Nothing}) ; @ iterators.jl:1550 within `only` define void @julia_only_6824({}* noundef nonnull %"x::RefValue") #0 { top: ; @ iterators.jl:1559 within `only` ret void } julia> @code_llvm only('z') ; Function Signature: only(Char) ; @ iterators.jl:1550 within `only` define i32 @julia_only_6826(i32 zeroext %"x::Char") #0 { top: ; @ iterators.jl:1559 within `only` ret i32 %"x::Char" } julia> @code_llvm only((4,)) ; Function Signature: only(Tuple{Int64}) ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1566 within `only` define i64 @julia_only_6833([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::Tuple") #0 { top: ; ┌ @ tuple.jl:31 within `getindex` %"x::Tuple[1]_ptr" = getelementptr inbounds [1 x i64], [1 x i64]* %"x::Tuple", i64 0, i64 0 ; └ %"x::Tuple[1]_ptr.unbox" = load i64, i64* %"x::Tuple[1]_ptr", align 8 ret i64 %"x::Tuple[1]_ptr.unbox" } julia> @code_llvm only((nothing,)) ; Function Signature: only(Tuple{Nothing}) ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1566 within `only` define void @julia_only_6836() #0 { top: ret void } julia> only((4,2)) ERROR: ArgumentError: Tuple contains 2 elements, must contain exactly 1 element Stacktrace: [1] only(x::Tuple{Int64, Int64}) @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1564 [2] top-level scope @ REPL[31]:1 julia> @code_llvm only(Array{Int, 0}(undef)) ; Function Signature: only(Array{Int64, 0}) ; @ iterators.jl:1550 within `only` define i64 @julia_only_6848({}* noundef nonnull align 8 dereferenceable(16) %"x::Array") #0 { L60: ; @ iterators.jl:1551 within `only` ; ┌ @ array.jl:884 within `iterate` @ array.jl:884 ; │┌ @ essentials.jl:817 within `getindex` %0 = bitcast {}* %"x::Array" to i64** %1 = load i64*, i64** %0, align 8 %2 = load i64, i64* %1, align 8 ; └└ ; @ iterators.jl:1559 within `only` ret i64 %2 } julia> @code_llvm only((;x=3)) ; Function Signature: only(NamedTuple{(:x,), Tuple{Int64}}) ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1571 within `only` define i64 @julia_only_6871([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::NamedTuple") #0 { top: ; ┌ @ abstractarray.jl:469 within `first` ; │┌ @ namedtuple.jl:165 within `iterate` @ namedtuple.jl:165 %"x::NamedTuple.x_ptr" = getelementptr inbounds [1 x i64], [1 x i64]* %"x::NamedTuple", i64 0, i64 0 ; └└ %"x::NamedTuple.x_ptr.unbox" = load i64, i64* %"x::NamedTuple.x_ptr", align 8 ret i64 %"x::NamedTuple.x_ptr.unbox" } julia> only((;)) ERROR: ArgumentError: NamedTuple contains 0 elements, must contain exactly 1 element Stacktrace: [1] only(x::@NamedTuple{}) @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1568 [2] top-level scope @ REPL[34]:1 julia> only((;x=2, y=4)) ERROR: ArgumentError: NamedTuple contains 2 elements, must contain exactly 1 element Stacktrace: [1] only(x::@NamedTuple{x::Int64, y::Int64}) @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1568 [2] top-level scope @ REPL[35]:1 ``` Diff ```diff < # Before --- > # After 4,5c4,5 < ; @ iterators.jl:1563 within `only` < define i64 @julia_only_2451({}* noundef nonnull align 8 dereferenceable(8) %"x::RefValue") #0 { --- > ; @ iterators.jl:1550 within `only` > define i64 @julia_only_6821({}* noundef nonnull align 8 dereferenceable(8) %"x::RefValue") #0 { 7,11c7,14 < ; ┌ @ refvalue.jl:59 within `getindex` < ; │┌ @ Base.jl:49 within `getproperty` < %0 = bitcast {}* %"x::RefValue" to i64* < %.x = load i64, i64* %0, align 8 < ; └└ --- > ; @ iterators.jl:1551 within `only` > ; ┌ @ refpointer.jl:103 within `iterate` > ; │┌ @ refvalue.jl:59 within `getindex` > ; ││┌ @ Base.jl:49 within `getproperty` > %0 = bitcast {}* %"x::RefValue" to i64* > %.x = load i64, i64* %0, align 8 > ; └└└ > ; @ iterators.jl:1559 within `only` 17,18c20,21 < ; @ iterators.jl:1563 within `only` < define void @julia_only_2519({}* noundef nonnull %"x::RefValue") #0 { --- > ; @ iterators.jl:1550 within `only` > define void @julia_only_6824({}* noundef nonnull %"x::RefValue") #0 { 19a23 > ; @ iterators.jl:1559 within `only` 25,26c29,30 < ; @ iterators.jl:1565 within `only` < define i32 @julia_only_2527(i32 zeroext %"x::Char") #0 { --- > ; @ iterators.jl:1550 within `only` > define i32 @julia_only_6826(i32 zeroext %"x::Char") #0 { 27a32 > ; @ iterators.jl:1559 within `only` 33,34c38,39 < ; @ iterators.jl:1566 within `only` < define i64 @julia_only_2529([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::Tuple") #0 { --- > ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1566 within `only` > define i64 @julia_only_6833([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::Tuple") #0 { 45,46c50,51 < ; @ iterators.jl:1566 within `only` < define void @julia_only_2532() #0 { --- > ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1566 within `only` > define void @julia_only_6836() #0 { 55c60 < @ Base.Iterators ./iterators.jl:1567 --- > @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1564 57c62 < @ REPL[6]:1 --- > @ REPL[31]:1 61,70c66,76 < ; @ iterators.jl:1570 within `only` < define i64 @julia_only_2779({}* noundef nonnull align 8 dereferenceable(16) %"a::Array") #0 { < top: < ; ┌ @ abstractarray.jl:1314 within `getindex` < ; │┌ @ abstractarray.jl:1343 within `_getindex` < ; ││┌ @ essentials.jl:817 within `getindex` < %0 = bitcast {}* %"a::Array" to i64** < %1 = load i64*, i64** %0, align 8 < %2 = load i64, i64* %1, align 8 < ; └└└ --- > ; @ iterators.jl:1550 within `only` > define i64 @julia_only_6848({}* noundef nonnull align 8 dereferenceable(16) %"x::Array") #0 { > L60: > ; @ iterators.jl:1551 within `only` > ; ┌ @ array.jl:884 within `iterate` @ array.jl:884 > ; │┌ @ essentials.jl:817 within `getindex` > %0 = bitcast {}* %"x::Array" to i64** > %1 = load i64*, i64** %0, align 8 > %2 = load i64, i64* %1, align 8 > ; └└ > ; @ iterators.jl:1559 within `only` 76,77c82,83 < ; @ iterators.jl:1571 within `only` < define i64 @julia_only_2794([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::NamedTuple") #0 { --- > ; @ /Users/x/.julia/dev/julia/base/iterators.jl:1571 within `only` > define i64 @julia_only_6871([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"x::NamedTuple") #0 { 91c97 < @ Base.Iterators ./iterators.jl:1572 --- > @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1568 93c99 < @ REPL[9]:1 --- > @ REPL[34]:1 99c105 < @ Base.Iterators ./iterators.jl:1572 --- > @ Base.Iterators ~/.julia/dev/julia/base/iterators.jl:1568 101c107 < @ REPL[10]:1 --- > @ REPL[35]:1 ``` --------- Co-authored-by: matthias314 <matthias314@posteo.net> Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> 28 November 2023, 14:39:40 UTC
df40bab fix invalidations related to `ismutable` (#52170) Related to #52134. It would be nice if the underlying inference issue was fixed but this seems to be a hotfix for now. I have seen this inference problem occurring in Julia v1.9, v1.10, and current `master`. For example, on Julia v1.9.3, I get ```julia julia> code_warntype(ismutable, (Function,)) MethodInstance for ismutable(::Function) from ismutable(x) @ Base reflection.jl:521 Arguments #self#::Core.Const(ismutable) x::Function Body::Any 1 ─ nothing │ nothing │ %3 = Base.typeof(x)::Type{<:Function} │ %4 = Base.getproperty(%3, :name)::Any │ %5 = Base.getproperty(%4, :flags)::Any │ %6 = (%5 & 0x02)::Any │ %7 = (%6 == 0x02)::Any └── return %7 ``` This causes some invalidations when `using OrdinaryDiffEq`. 28 November 2023, 12:19:12 UTC
72dbbdb cfg_simplify: Handle various corner cases with try/catch blocks (#52323) Mostly long-standing bugs related to not handling the virtual predecessor to catch blocks, but also one recent regression from the EnterNode change. 28 November 2023, 05:18:39 UTC
5b2fcb6 Compiler support for optimizing PersistentDict (#51993) This is part of the work to address #51352 by attempting to allow the compiler to perform SRAO on persistent data structures like `PersistentDict` as if they were regular immutable data structures. These sorts of data structures have very complicated internals (with lots of mutation, memory sharing, etc.), but a relatively simple interface. As such, it is unlikely that our compiler will have sufficient power to optimize this interface by analyzing the implementation. We thus need to come up with some other mechanism that gives the compiler license to perform the requisite optimization. One way would be to just hardcode `PersistentDict` into the compiler, optimizing it like any of the other builtin datatypes. However, this is of course very unsatisfying. At the other end of the spectrum would be something like a generic rewrite rule system (e-graphs anyone?) that would let the PersistentDict implementation declare its interface to the compiler and the compiler would use this for optimization (in a perfect world, the actual rewrite would then be checked using some sort of formal methods). I think that would be interesting, but we're very far from even being able to design something like that (at least in Base - experiments with external AbstractInterpreters in this direction are encouraged). This PR tries to come up with a reasonable middle ground, where the compiler gets some knowledge of the protocol hardcoded without having to know about the implementation details of the data structure. The basic ideas is that `Core` provides some magic generic functions that implementations can extend. Semantically, they are not special. They dispatch as usual, and implementations are expected to work properly even in the absence of any compiler optimizations. However, the compiler is semantically permitted to perform structural optimization using these magic generic functions. In the concrete case, this PR introduces the `KeyValue` interface which consists of two generic functions, `get` and `set`. The core optimization is that the compiler is allowed to rewrite any occurrence of `get(set(x, k, v), k)` into `v` without additional legality checks. In particular, the compiler performs no type checks, conversions, etc. The higher level implementation code is expected to do all that. This approach closely matches the general direction we've been taking in external AbstractInterpreters for embedding additional semantics and optimization opportunities into Julia code (although we generally use methods there, rather than full generic functions), so I think we have some evidence that this sort of approach works reasonably well. Nevertheless, this is certainly an experiment and the interface is explicitly declared unstable. ## Current Status This is fully working and implemented, but the optimization currently bails on anything but the simplest cases. Filling all those cases in is not particularly hard, but should be done along with a more invasive refactoring of SROA, so we should figure out the general direction here first and then we can finish all that up in a follow-up cleanup. ## Obligatory benchmark Before: ``` julia> using BenchmarkTools julia> function foo() a = Base.PersistentDict(:a => 1) return a[:a] end foo (generic function with 1 method) julia> @benchmark foo() BenchmarkTools.Trial: 10000 samples with 993 evaluations. Range (min … max): 32.940 ns … 28.754 μs ┊ GC (min … max): 0.00% … 99.76% Time (median): 49.647 ns ┊ GC (median): 0.00% Time (mean ± σ): 57.519 ns ± 333.275 ns ┊ GC (mean ± σ): 10.81% ± 2.22% ▃█▅ ▁▃▅▅▃▁ ▁▃▂ ▂ ▁▂▄▃▅▇███▇▃▁▂▁▁▁▁▁▁▁▁▂▂▅██████▅▂▁▁▁▁▁▁▁▁▁▁▂▃▃▇███▇▆███▆▄▃▃▂▂ ▃ 32.9 ns Histogram: frequency by time 68.6 ns < Memory estimate: 128 bytes, allocs estimate: 4. julia> @code_typed foo() CodeInfo( 1 ─ %1 = invoke Vector{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}}(Base.HashArrayMappedTries.undef::UndefInitializer, 1::Int64)::Vector{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}} │ %2 = %new(Base.HashArrayMappedTries.HAMT{Symbol, Int64}, %1, 0x00000000)::Base.HashArrayMappedTries.HAMT{Symbol, Int64} │ %3 = %new(Base.HashArrayMappedTries.Leaf{Symbol, Int64}, :a, 1)::Base.HashArrayMappedTries.Leaf{Symbol, Int64} │ %4 = Base.getfield(%2, :data)::Vector{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}} │ %5 = $(Expr(:boundscheck, true))::Bool └── goto #5 if not %5 2 ─ %7 = Base.sub_int(1, 1)::Int64 │ %8 = Base.bitcast(UInt64, %7)::UInt64 │ %9 = Base.getfield(%4, :size)::Tuple{Int64} │ %10 = $(Expr(:boundscheck, true))::Bool │ %11 = Base.getfield(%9, 1, %10)::Int64 │ %12 = Base.bitcast(UInt64, %11)::UInt64 │ %13 = Base.ult_int(%8, %12)::Bool └── goto #4 if not %13 3 ─ goto #5 4 ─ %16 = Core.tuple(1)::Tuple{Int64} │ invoke Base.throw_boundserror(%4::Vector{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}}, %16::Tuple{Int64})::Union{} └── unreachable 5 ┄ %19 = Base.getfield(%4, :ref)::MemoryRef{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}} │ %20 = Base.memoryref(%19, 1, false)::MemoryRef{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}} │ Base.memoryrefset!(%20, %3, :not_atomic, false)::MemoryRef{Union{Base.HashArrayMappedTries.HAMT{Symbol, Int64}, Base.HashArrayMappedTries.Leaf{Symbol, Int64}}} └── goto #6 6 ─ %23 = Base.getfield(%2, :bitmap)::UInt32 │ %24 = Base.or_int(%23, 0x00010000)::UInt32 │ Base.setfield!(%2, :bitmap, %24)::UInt32 └── goto #7 7 ─ %27 = %new(Base.PersistentDict{Symbol, Int64}, %2)::Base.PersistentDict{Symbol, Int64} └── goto #8 8 ─ %29 = invoke Base.getindex(%27::Base.PersistentDict{Symbol, Int64}, :a::Symbol)::Int64 └── return %29 ``` After: ``` julia> using BenchmarkTools julia> function foo() a = Base.PersistentDict(:a => 1) return a[:a] end foo (generic function with 1 method) julia> @benchmark foo() BenchmarkTools.Trial: 10000 samples with 1000 evaluations. Range (min … max): 2.459 ns … 11.320 ns ┊ GC (min … max): 0.00% … 0.00% Time (median): 2.460 ns ┊ GC (median): 0.00% Time (mean ± σ): 2.469 ns ± 0.183 ns ┊ GC (mean ± σ): 0.00% ± 0.00% ▂ █ ▁ █ ▂ █▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁█ █ 2.46 ns Histogram: log(frequency) by time 2.47 ns < Memory estimate: 0 bytes, allocs estimate: 0. julia> @code_typed foo() CodeInfo( 1 ─ return 1 ``` 27 November 2023, 17:01:53 UTC
9233a16 Document Base.StatStruct's fields as public (#50177) These fields are documented in the docstring of `stat`, and also mentioned as being public in the style guide, but their types are not documented, nor is `StatStruct` directly documented. --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com> 27 November 2023, 06:01:45 UTC
9dcedaa Memoize `cwstring` when used for env lookup / modification on Windows (#51371) ~This is just me proposing a suggestion from @KristofferC in https://discourse.julialang.org/t/debug-has-massive-performance-impact/103974/22, it's all his code / idea, not mine.~ This PR makes it so that on windows, we pre-allocate an `IdDict` and every time someone looks up environment variables (motivating example here is `@debug` statements), we store the result of `cwstring(::String)` in that `IdDict` so that it doesn't need to be re-computed for future uses. The idea behind this is that people have observed that [using `@debug` is significantly more costly on Windows than other platforms](https://discourse.julialang.org/t/debug-has-massive-performance-impact/103974), even though we have documented in that manual that it should be a really cheap operation. @KristofferC suggests this is due to the fact that [checking environment variables in Windows is more costly](https://discourse.julialang.org/t/debug-has-massive-performance-impact/103974/18). ~The idea here is that we preallocate a `Cwstring` on Windows that just holds the text `"JULIA_DEBUG"`, so that if `access_env(f, "JULIA_DEBUG")` gets called, we don't need to create a new `Cwstring` and then throw it away each time.~ --------- Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com> Co-authored-by: Jameson Nash <vtjnash@gmail.com> 27 November 2023, 06:00:19 UTC
4a18886 More helpful error message for empty `cpu_target` in `Base.julia_cmd` (#52217) Fix #52209. 27 November 2023, 05:27:30 UTC
08d89eb codegen: fix ssa order regression from initializing structs (#52311) 27 November 2023, 04:27:43 UTC
cd4f49a Give a better assertion failure for module serialization issues (#52306) This issue confused me for a few hours. Basically what happened was that I had some IR that verified fine, but did not survive a deserialization round-trip (related to mismatching pointer types, which of course are starting to lose their meaning in LLVM). In this situation, the first assertion hit was the failure to verify the LLVM module at the output, but I had a hard time figuring out where this IR was coming from, since it looked totally corrupted. If LLVM assertions had been enabled, I would have seen the cantFail give a proper error, but since I only had Julia assertions enabled, I did not see this error message. Try to improve this situation by also asserting the absence of serialization errors using Julia assertions, not just LLVM assertions. 26 November 2023, 20:30:58 UTC
c30d45d Make :enter a proper node type (#52300) This is a prepratory commit in anticipation of giving :enter additional responsibilities of entering and restoring dynamic scopes for ScopedValue (c.f. #51352). This commit simply turns `:enter` into its own node type (like the other terminators). The changes are largely mechanical from the `Expr` version, but will make it easier to add additional semantics in a follow up PR. 26 November 2023, 16:05:52 UTC
49c2d89 jltypes: avoid creating lots of duplicates of this function (#52299) Core.Compiler calls this on many functions, creating associated Types inferred for each for some reason. This saves several MB from the system image. 26 November 2023, 05:20:52 UTC
9ea29d9 Make PersistentDict behave like an IdDict (#52193) 25 November 2023, 15:13:27 UTC
ea261ce Automatically :leave the exception frame on the catch edge (#52245) Right now, we require a :leave expression at both the end of a try region and as the first expression in the catch block. This doesn't really make sense. Throwing the exception should leave the exception frame implicitly. This isn't a huge saving, but does save one IR node (and generated call in the native code) per try/catch block. 25 November 2023, 14:16:02 UTC
18c6c66 Bail out of constprop if we already know it's gonna throw an error (#52293) While looking at some other things, I noticed that we call concrete evaluation on every `error("foo")`-like call just to find out again that it errors. which is obviously wasteful. In the future we may want to model exception-`:consistent`-cy in which case there could be some additional `exct` refinement here, but we're not there yet. --------- Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> 25 November 2023, 14:15:48 UTC
cb01a3b optimized (and ordered) IdSet code (#52114) We have had this smallintset code around for a while for internal purposes, though it was not quite fully general purpose (it didn't have pop). We also have around this tiny global_roots_table (about 1500 entries after building the sysig). This saves about 50% of the space for storing that table. It also optimizes all other IdSet code to not be an inefficient mutable wrapper around an IdDict, but instead be an ordered (by first insertion) set type of its own. 25 November 2023, 04:45:22 UTC
cc4424e Improve type-inference in complex eigen (#52290) Indexing using integers instead of a `Vector` uses constant-propagation to improve the inferred return types. After this, the return type of `eigen(::Matrix{ComplexF64})` is inferred as a small union. ```julia julia> @code_typed eigen(rand(ComplexF64,2,2)) CodeInfo( 1 ─ %1 = invoke LinearAlgebra.:(var"#eigen#94")(true::Bool, true::Bool, LinearAlgebra.eigsortby::typeof(LinearAlgebra.eigsortby), #self#::typeof(eigen), A::Matrix{ComplexF64})::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} └── return %1 ) => Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}} ``` Close #52289 25 November 2023, 02:35:05 UTC
back to top