-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8329816: Add SLEEF version 3.6.1 #19185
Conversation
👋 Welcome back mikael! A progress list of the required criteria for merging this PR into |
@vidmik This change is no longer ready for integration - check the PR body for details. |
Webrevs
|
Thanks for working on this. |
Looks like that change is not yet in a released version of SLEEF, and in particular not in 3.6. We do need updated approvals when we pick up new versions. Since we've gone through the process once it's typically easier/faster to do so. It will be technically easier/faster as well, now that I know how to do it and have encoded it in the createSleef.sh script. |
Thanks, I see. I'm OK to push this pr first, if it's also convenient for you, as we will need to push the change between 3.6.1/3.7 and 3.6 again when 3.6.1/3.7 is released. |
Let me suggest that we wait for the next release of SLEEF to be released in that case since that release seems to be imminent. That way we'll get both the performance fixes and we can include the RISC-V header files at the same time. Fair? |
Yes, it makes sense to me. Thanks! |
Thank you Hamlin. I'll try to keep my eyes open for the announcement of the upcoming SLEEF release but do feel free to notify me if you see it first! |
Thank you @vidmik , sure, I will do it. |
I, too, envision that we'll be importing header files (only). That said, I'd very much prefer not to rename them as part of the import. If anything I could see us have architecture specific directories in which we place the respective files (and a common directory for |
I understand that you want to avoid renaming files, if they are imported. That is a good point. Moving them to an arch subdirectory does not seem like much additional hassle (there's apparently still a lot of manual work involved in upgrading the source from the third party upstream), and might help readers that are not deeply familiar with these platforms. But then again, if we only talk about header files, it is not strictly needed, so if you don't want to do it, then skip it. |
Hi @vidmik, |
In case you need it and avoid to generate yourself, I've generated sleef inline header of 3.6.1 for riscv, it's at c279a3c |
@vidmik Thanks for updating, I think I'd better to verify it in case we need uncessary further changes. Will update when I finish. |
@vidmik I have verified the tests and performance for aarch64, it's good as before, I also updated related information in #18605. |
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.
Just some minor comments in README, otherwise looks good.
|
||
NOTE: The following cmake options are necessary when building SLEEF: | ||
* -DSLEEF_BUILD_INLINE_HEADERS=ON | ||
* -DSLEEF_ENFORCE_SVE=ON |
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.
-DSLEEF_ENFORCE_SVE=ON
can be removed.
|
||
### Step 4: Make necessary changes to resolve any build issues in case there is any | ||
|
||
Currently, the only necessary change is: | ||
* make `Sleef_rempitabdp` and `Sleef_rempitabsp` in sleefinline_advsimd.h and sleefinline_sve.h `static` to avoid multiple definitions. |
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.
These lines can be removed now.
An quick update, I just verified via QEMU that sleefinline_rvvm1.h works well too. |
@vidmik This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
Hi @vidmik @theRealAph , |
Responding to the discussion in #18605 here as this is the PR actually adding SLEEF to the JDK source. I was initially of the opinion that the solution already provided here was enough. We could potentially have added a Git hash in addition to the version/tag to more precisely and permanently identify the exact Sleef source we are depending on. At least a Git hash wouldn't change externally. However, Andrew's arguments have swayed me. I now think we should add a more or less complete dump of the Sleef source into the JDK repository. I'm still open to trimming it down somewhat as long as the build steps we need to run to generate the headers we need, using the Sleef build system, are still functional. I'm basically agreeing with his suggestion but will spell it out in detail here for completeness in this PR. We should then add a script that automatically performs the necessary build steps, using the Sleef official build system, to generate the headers we need, and outputs them into the JDK source tree, in the location where we will also commit those headers. This script should document what dependencies and configuration is necessary to run it, which will include cmake and possibly other things. Performing this step doesn't need to be completely streamlined, just reasonably possible to run. It's meant to be an import/verification step. With this solution I would recommend putting the script next to the Sleef source tree instead of in make/devkit/. The normal JDK build will just use the committed pre-generated headers. I looked briefly at the heroic build work provided by @fitzsim and while I admire the effort, I don't think this is the right way and we already dismissed this approach earlier. Not because I didn't think it was feasible to implement, but because of the future maintenance burden. The Sleef build is non trivial so we shouldn't try to replicate it in our build. The risk of our implementation diverging in the future is too great. |
I agree with @erikj79, in particular the above 3 points. Shall we be ready to move forward? Or we're still blocked by some other issues, such as legal process? |
Sounds good, thanks.
OK. I had a brief meeting with Mark Reinhold to discuss this issue. I asked him if it would ever be acceptable to check in preprocessed code without the corresponding preferred from, and the immediate answer was an emphatic "no". So that's that. I'm neutral on just how much of SLEEF should be checked into our source tree. As long as we include the full source for whatever subset of SLEEF we use, and it is the real source in its preferred form, I'm happy. |
I'm following up on the necessary logistics given the new plan. |
@Hamlin-Li We now have the necessary approvals in place for the new plan to include all of SLEEF (and the pre-generated header files) in the JDK. I (or somebody else from Oracle) will need to be the one committing/contributing the actual SLEEF code itself in the end. Can you take on the work of implementing the actual plan/logic and make sure it's all effectively ready for integration? |
@vidmik Thanks for pushing forward this work. Just several questions, Sorry, as this is the first time I do this kind of work in jdk. |
@Hamlin-Li Thank you for taking it on! Part of the work is figuring out exactly what exactly we want - see the comments from @erikj79 and @theRealAph in this PR for inspiration. In particular, we'll want to include all or part of the SLEEF sources in the JDK, but we'll likely also want some additional build scripts and documentation to make it easy for developers to reproduce and update going forward. This could probably be based on the README and createSleef script. |
@vidmik Thanks for clarifying, I'll figure it out. |
I think this will need some discussion to get it right, both from a We're doing something that is quite new to the JDK source code base and build system, after all. Some questions that needs to be answered:
|
By understanding the previous discussion, there should be 2 parts of source code related to sleef integrated into jdk: Besides of above sources, there should be another part connecting above 2 parts, i.e. So, for the source layout/organization, the previous conclusion is to have both 1] and 2], and 1] is just for verification and reproducing, general build of jdk only needs 2]. As to where to put various new files, I think current location for 2] in this pr is good, 1] could be put somewhere with minimum impact on current build system,
As for which part of original sleef source to integreate into jdk, we could trim the original source in some way, but I think it's more simple and maintainable to just put all sleef source into jdk without any trim. |
In addition to the tag, we should include the full git hash as well. A tag can be moved, but it's very hard to fake a new git hash for a commit if any changes are made. |
I agree, thanks for reminding! I also updated my comment above. |
After thinking a bit more on this, I would recommend a somewhat different layout:
The README.md file should briefly but clearly explain how we handle libsleef |
In the build system, we will then add jdk.incubator.vector/linux/native/libsleef/generated as an additional source root when building libvectormath. |
Furthermore, despite what Erik said above, I would really, really like to not have a stand-alone shell script mixed in with the spleef sources. Instead, we should treat updating the generated spleef sources as any other build-related activities, that is, we should have a build target for that. I imagine we would have a The prerequisites required for doing this, e.g. having cmake available (and possibly any other requirements?) should be checked by configure. There are two slightly different nuances on how we handle these dependencies: We could either add a The other alternative, if the one above would be too much, is to just set the dependencies in configure if they are found, and then verify in UpdateSpleefSource.gmk that they are non-empty (and fail with an error otherwise). This is contrary to the general design of the build system, but might be acceptable in a special case like this, to gain a bit of simplicity in the code. |
I can help you with the build system changes, if what I wrote above made no sense to you. |
I'm ok with this as you are offering to help implement it. My suggestion for using a separate script was out of simplicity and an assumed lack of resourcing for a more involved solution. Your suggested solution would generally be a better end result. |
Thanks, this is much better.
I'm ok too with either of solutions. |
@vidmik @Hamlin-Li I kind of hijacked this... I created the necessary build system changes to update the generated sleef code. At that point, also importing the actual source code was just a trivial addition. The new PR is here: #20781 I think it implements everything we've talked about here, in the way I understood consensus to be. |
@vidmik this pull request can not be integrated into git checkout 8329816-sleef
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
JDK-8312425 is looking to optimize vector math operations by leveraging the SLEEF library. For legal reasons the actual contribution of the SLEEF files needs to be handled separately. This enhancement adds the relevant files, enabling the rest of JDK-8312425 to move forward.
Progress
Issue
Backport <hash>
with the hash of the original commit. See Backports.Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19185/head:pull/19185
$ git checkout pull/19185
Update a local copy of the PR:
$ git checkout pull/19185
$ git pull https://git.openjdk.org/jdk.git pull/19185/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19185
View PR using the GUI difftool:
$ git pr show -t 19185
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19185.diff
Webrev
Link to Webrev Comment