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

Split treelite fil import from forest object definition #4306

Merged
merged 10 commits into from
Nov 3, 2021

Conversation

levsnv
Copy link
Contributor

@levsnv levsnv commented Oct 23, 2021

To improve readability of the code, split fil.cu in two files. Clean up transitive includes along the way.

This change only moves code (LoC) around and then edits header include list to comply with IWYU.
To verify that no other lines have been altered by this PR, one can:

git remote add levs git@github.com:levsnv/cuml.git
git fetch levs

cd cpp/src/fil
git checkout f6ded9e72458898c71a3688b72cc51b73dc47d6b fil.cu
cp fil.cu old-fil.cu
git reset --hard

git checkout levs/split-treelite-fil-import

diff <(cat old-fil.cu | sort) <(cat treelite_import.cu fil.cu | sort)

This will also show renaming 4 to MAX_N_ITEMS, which happened in a different PR in the meantime.

@levsnv levsnv requested review from a team as code owners October 23, 2021 08:30
@levsnv levsnv requested a review from canonizer October 23, 2021 08:30
@levsnv levsnv added 2 - In Progress Currenty a work in progress non-breaking Non-breaking change Tech Debt Issues related to debt improvement Improvement / enhancement to an existing function labels Oct 23, 2021
cpp/src/fil/infer.cu Outdated Show resolved Hide resolved
Copy link
Contributor

@robertmaynard robertmaynard left a comment

Choose a reason for hiding this comment

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

CMake changes LGTM

@caryr35 caryr35 added this to PR-WIP in v21.12 Release via automation Oct 25, 2021
@caryr35 caryr35 moved this from PR-WIP to PR-Needs review in v21.12 Release Oct 25, 2021
@levsnv levsnv added 4 - Waiting on Reviewer Waiting for reviewer to review or respond and removed 2 - In Progress Currenty a work in progress labels Oct 27, 2021
@levsnv levsnv requested a review from wphicks October 27, 2021 05:34
Copy link
Contributor

@wphicks wphicks left a comment

Choose a reason for hiding this comment

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

Beautiful! 😄

Copy link
Contributor

@canonizer canonizer left a comment

Choose a reason for hiding this comment

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

Great work!

Approved, provided that the comments (few and technical) are addressed.

cpp/src/fil/fil.cu Outdated Show resolved Hide resolved

#include "common.cuh"
#include "common.cuh" // for predict_params, sparse_storage, dense_storage
Copy link
Contributor

Choose a reason for hiding this comment

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

Great work tracking down the symbols used from each include file!

I wonder, though, how much extra work would it be to maintain these lists?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we have this in place, it provides a starting place for later integration of automated tooling to maintain it. IWYU does this, and (assuming nothing changes with IWYU cuda support), we might slowly build up scripts with cppclean and ctags (similar to the work that @levsnv has already begun) that would provide similar functionality in the long term. I very much appreciate having them there given our efforts to clean up includes and improve build time, and I'm happy to manually maintain them in any of my changes until we have better tooling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I've shared the scripts, this is how a typical output looks like: fil.cu tag-header pair candidates
135 lines for fil.cu. After merging branch-21.12, the (dwdiff --color) highlights only two new terms:

cats_present	common.cuh	44;"	function	line:44	struct:ML::fil::storage_base	signature:() const
cats_present	internal.cuh	329;"	function	line:329	struct:ML::fil::categorical_sets	signature:() const

The rest are line number changes. Someone just needs to wrap this into a bash one-liner.

cpp/src/fil/fil.cu Show resolved Hide resolved
cpp/src/fil/treelite_import.cu Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.12@effa6cd). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.12    #4306   +/-   ##
===============================================
  Coverage                ?   86.06%           
===============================================
  Files                   ?      231           
  Lines                   ?    18702           
  Branches                ?        0           
===============================================
  Hits                    ?    16095           
  Misses                  ?     2607           
  Partials                ?        0           
Flag Coverage Δ
dask 47.00% <0.00%> (?)
non-dask 78.74% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update effa6cd...de76623. Read the comment docs.

@levsnv levsnv added the 0 - Blocked Cannot progress due to external reasons label Nov 2, 2021
@levsnv
Copy link
Contributor Author

levsnv commented Nov 2, 2021

Blocked because cannot merge other PRs to FIL as that would complicate verifying that this PR mostly moves lines of code around.

@levsnv levsnv removed the 0 - Blocked Cannot progress due to external reasons label Nov 3, 2021
@levsnv
Copy link
Contributor Author

levsnv commented Nov 3, 2021

removed "Blocked" due to build issues on this PR

v21.12 Release automation moved this from PR-Needs review to PR-Reviewer approved Nov 3, 2021
@dantegd
Copy link
Member

dantegd commented Nov 3, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 6c99d64 into rapidsai:branch-21.12 Nov 3, 2021
v21.12 Release automation moved this from PR-Reviewer approved to Done Nov 3, 2021
vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this pull request Oct 9, 2023
)

To improve readability of the code, split `fil.cu` in two files. Clean up transitive includes along the way.

This change only moves code (LoC) around and then edits header include list to comply with IWYU.
To verify that no other lines have been altered by this PR, one can:
```
git remote add levs git@github.com:levsnv/cuml.git
git fetch levs

cd cpp/src/fil
git checkout 33e14c8 fil.cu
cp fil.cu old-fil.cu
git reset --hard

git checkout levs/split-treelite-fil-import

diff <(cat old-fil.cu | sort) <(cat treelite_import.cu fil.cu | sort)
```
This will also show renaming `4` to `MAX_N_ITEMS`, which happened in a different PR in the meantime.

Authors:
  - Levs Dolgovs (https://github.com/levsnv)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - William Hicks (https://github.com/wphicks)
  - Andy Adinets (https://github.com/canonizer)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: rapidsai#4306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Waiting on Reviewer Waiting for reviewer to review or respond CMake CUDA/C++ improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Tech Debt Issues related to debt
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants