Fix _unsafe_trunc to reduce the likelihood of arbitrary values#291
Merged
kimikage merged 1 commit intoJuliaMath:masterfrom Apr 30, 2024
Merged
Fix _unsafe_trunc to reduce the likelihood of arbitrary values#291kimikage merged 1 commit intoJuliaMath:masterfrom
_unsafe_trunc to reduce the likelihood of arbitrary values#291kimikage merged 1 commit intoJuliaMath:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #291 +/- ##
==========================================
- Coverage 97.05% 96.93% -0.13%
==========================================
Files 7 7
Lines 782 784 +2
==========================================
+ Hits 759 760 +1
- Misses 23 24 +1 ☔ View full report in Codecov by Sentry. |
Collaborator
Author
Benchmark (x86-64 Windows)As for x86-64, there is no major performance regression. using FixedPointNumbers
using BenchmarkTools
mat_f64 = rand(Float64, 1000, 1000) .* 2 .- 1;
mat_f32 = rand(Float32, 1000, 1000) .* 2 .- 1;
@btime $mat_f64 .% N0f8;
@btime $mat_f64 .% N0f16;
@btime $mat_f64 .% N16f16;
@btime $mat_f32 .% N0f8;
@btime $mat_f32 .% N0f16;
@btime $mat_f32 .% N16f16;
@btime $mat_f64 .% Q0f7;
@btime $mat_f64 .% Q0f15;
@btime $mat_f64 .% Q15f16;
@btime $mat_f32 .% Q0f7;
@btime $mat_f32 .% Q0f15;
@btime $mat_f32 .% Q15f16;julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)beforejulia> @btime $mat_f64 .% N0f8;
214.200 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f64 .% N0f16;
428.900 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f64 .% N16f16;
1.118 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f32 .% N0f8;
119.000 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f32 .% N0f16;
327.400 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f32 .% N16f16;
1.095 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f64 .% Q0f7;
216.300 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f64 .% Q0f15;
436.200 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f64 .% Q15f16;
1.123 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f32 .% Q0f7;
116.900 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f32 .% Q0f15;
288.300 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f32 .% Q15f16;
1.122 ms (2 allocations: 3.81 MiB)afterjulia> @btime $mat_f64 .% N0f8;
202.500 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f64 .% N0f16;
415.000 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f64 .% N16f16;
1.403 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f32 .% N0f8;
115.600 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f32 .% N0f16;
322.200 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f32 .% N16f16;
1.383 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f64 .% Q0f7;
205.500 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f64 .% Q0f15;
417.700 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f64 .% Q15f16;
1.120 ms (2 allocations: 3.81 MiB)
julia> @btime $mat_f32 .% Q0f7;
116.200 μs (2 allocations: 976.67 KiB)
julia> @btime $mat_f32 .% Q0f15;
329.200 μs (2 allocations: 1.91 MiB)
julia> @btime $mat_f32 .% Q15f16;
1.175 ms (2 allocations: 3.81 MiB) |
Collaborator
Author
|
We are having problems testing ColorTypes.jl. So, I am going to backport this to v0.8. |
Collaborator
Author
|
In any case, this PR is a bug fix, so I will merge it first. |
This was referenced Apr 30, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
Apr 30, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
Apr 30, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 13, 2024
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 13, 2024
kimikage
added a commit
that referenced
this pull request
May 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes (mitigates) #288.