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

replace checked_fptosi intrinsics with Julia implementation #14763

Merged
merged 2 commits into from Sep 30, 2016

Conversation

simonbyrne
Copy link
Contributor

Fixes #14549.

As @yuyichao points out, this will effect inlining rules.

@simonbyrne simonbyrne changed the title markdown: ensure line-break after displayed math replace checked_fptosi intrinsics Jan 22, 2016
@simonbyrne simonbyrne changed the title replace checked_fptosi intrinsics replace checked_fptosi intrinsics with Julia implementation Jan 22, 2016
@yuyichao
Copy link
Contributor

Let's check =) runbenchmarks(ALL, vs = "JuliaLang/julia:master")

@simonbyrne
Copy link
Contributor Author

@nanosoldier runbenchmarks(ALL, vs=":master")

@simonbyrne
Copy link
Contributor Author

This has been updated to do an explicit range check, so should no longer utilise any undefined behaviour

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@simonbyrne
Copy link
Contributor Author

Hmm, the slowdown seems to be due to the fact that the length of FloatRange and LinSpace is a floating point number, which needs to be converted a lot.

@simonbyrne simonbyrne force-pushed the sb/fptosi branch 2 times, most recently from c92f76e to fea8f26 Compare September 21, 2016 11:24
throw(InexactError())
end
end
else #
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there going to be a comment here then changed your mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember, this was quite a long time ago (if only I had left a comment on what that comment was going to be...)

@simonbyrne
Copy link
Contributor Author

simonbyrne commented Sep 23, 2016

@nanosoldier runbenchmarks(ALL, vs=":master")

@jrevels
Copy link
Member

jrevels commented Sep 23, 2016

@simonbyrne looks like you may have submitted the job with the wrong syntax, and then edited to the correct syntax? Nanosoldier ignores comment edits to prevent accidental job resubmission. Triggering it with a new comment should work:

@nanosoldier runbenchmarks(ALL, vs=":master")

@simonbyrne
Copy link
Contributor Author

thanks!

@vchuravy
Copy link
Sponsor Member

Would this also work for Float16?

@simonbyrne
Copy link
Contributor Author

It should do, the logic is pretty much the same.

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@simonbyrne
Copy link
Contributor Author

Actually, it won't work for Float16, but I've added a note as to why. I didn't include the Float16 logic here, as the current method (converting to Float32 first) is probably more efficient.

@simonbyrne
Copy link
Contributor Author

simonbyrne commented Sep 24, 2016

Updated. It seems like the change in performance is a bit of a wash. We may want to look at speeding up FloatRange and LinSpace either by inlining or perhaps even redesigning so the length is stored as an integer, but this is probably better in a different PR.

Any objections to merging? cc @ViralBShah @vchuravy

@vchuravy
Copy link
Sponsor Member

No objections to merging.

I would still be interested in a implementation for Float16. Mostly because I am looking at improving our support for Float16 on platforms that support them natively.

@simonbyrne
Copy link
Contributor Author

It should be possible via an extra branch: just check if Tf(typemin(Ti)) == Inf, in which case use an inequality rather than equality for the lower bound.

@tkelman
Copy link
Contributor

tkelman commented Sep 24, 2016

that's a pretty bad slowdown in sparse indexing, worth looking into and profiling the difference

@simonbyrne
Copy link
Contributor Author

I couldn't figure it out: there don't appear to be any conversion calls, and I can't recreate it locally.

One more time:

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@simonbyrne
Copy link
Contributor Author

The sparse issue seems to have mostly gone.

@simonbyrne
Copy link
Contributor Author

Given the inconsistency, it seems that the regressions are mostly noise. We do get a nice speed boost on some though. Shall we merge this?

@musm
Copy link
Contributor

musm commented Sep 25, 2016

Out of curiosity, how reliable is nanosoldier if +-15% can be mainly attributed to noise?

@simonbyrne
Copy link
Contributor Author

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@simonbyrne
Copy link
Contributor Author

Okay, we'll have to figure out how to improve FloatRange and LinSpace indexing, but I think this is good to go.

@simonbyrne simonbyrne merged commit f935a50 into master Sep 30, 2016
@simonbyrne simonbyrne deleted the sb/fptosi branch September 30, 2016 12:13
@simonbyrne
Copy link
Contributor Author

Will probably want to backport this to get tests to pass on ARM/Power in next release.

@tkelman
Copy link
Contributor

tkelman commented Oct 7, 2016

jl_checked_fptoui and jl_checked_fptosi were exported from libjulia, but doesn't look like any packages call into them

tkelman pushed a commit that referenced this pull request Feb 22, 2017
Replaces checked_fptosi/checked_fptoui intrinsics with Julia implementations. Fixes #14549. Explain logic behind float->integer conversion checking

(cherry picked from commit f935a50)
tkelman added a commit that referenced this pull request Mar 5, 2017
This reverts commit ea37c3c.

Revert "replace checked_fptosi intrinsics with Julia implementation (#14763)"

This reverts commit 5512553.
caused significant slowdown in conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants