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 map_along_rows with matrixVectorOp #911

Merged
merged 30 commits into from
Nov 8, 2022

Conversation

Nyrio
Copy link
Contributor

@Nyrio Nyrio commented Oct 10, 2022

The prim matrixVectorOp is more optimized than the ANN util function map_along_rows. However, in order to substitute the latter, I needed to add better support for differing matrix and vector types.

This PR adds support to arbitrary matrix and vector types in matrix-vector ops. The input and output matrices must have the same type but the vectors can each have different types.

@Nyrio Nyrio added 2 - In Progress Currenty a work in progress CMake improvement Improvement / enhancement to an existing function non-breaking Non-breaking change and removed CMake labels Oct 10, 2022
@github-actions github-actions bot removed the CMake label Oct 20, 2022
@Nyrio Nyrio marked this pull request as ready for review October 20, 2022 14:44
@Nyrio Nyrio requested a review from a team as a code owner October 20, 2022 14:44
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

Changes look good from my end. Just fairly minor things as usual.

cpp/include/raft/linalg/matrix_vector_op.cuh Outdated Show resolved Hide resolved
@@ -22,80 +22,10 @@ namespace raft {
namespace linalg {
namespace detail {

namespace {
Copy link
Member

Choose a reason for hiding this comment

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

Are any of the changes in this file going to break users downstream (such as cuml)?

Copy link
Contributor Author

@Nyrio Nyrio Oct 28, 2022

Choose a reason for hiding this comment

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

It won't break cuML because all template types are inferred in calls to matrixVectorOp.
It could in theory break other projects if they provide the template list explicitly, but I'm not aware of any.

cpp/include/raft/linalg/matrix_vector_op.cuh Outdated Show resolved Hide resolved
cpp/include/raft/util/itertools.hpp Outdated Show resolved Hide resolved
@Nyrio
Copy link
Contributor Author

Nyrio commented Oct 28, 2022

I've solved the conflicts with #725 and #937 and done the changes requested by @cjnolet

Note that I see failures in the linewise tests with padded spans, not only on this branch but also on branch-22.12. I have informed @mfoerste4 about those failures (I suspect missing boundary checks when reading the vectors).

@mfoerste4
Copy link
Collaborator

I've solved the conflicts with #725 and #937 and done the changes requested by @cjnolet

Note that I see failures in the linewise tests with padded spans, not only on this branch but also on branch-22.12. I have informed @mfoerste4 about those failures (I suspect missing boundary checks when reading the vectors).

@Nyrio , thanks for finding this. I added #964 to fix the issue in the test setup.

rapids-bot bot pushed a commit that referenced this pull request Oct 28, 2022
This should fix the failures @Nyrio found in [#911](#911 (comment)). This is a test issue within a new testcase that was introduced by [#725](#725).

@cjnolet , FYI.

Authors:
  - Malte Förster (https://github.com/mfoerste4)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #964
@cjnolet
Copy link
Member

cjnolet commented Oct 28, 2022

@Nyrio the fix to linewise op has been merged.

@cjnolet
Copy link
Member

cjnolet commented Oct 29, 2022

rerun tests

@Nyrio
Copy link
Contributor Author

Nyrio commented Nov 2, 2022

rerun tests

Copy link
Contributor

@tfeher tfeher left a comment

Choose a reason for hiding this comment

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

Thanks @Nyrio for the PR! It looks good to me.


namespace raft {
namespace matrix {
namespace detail {

/** This type simplifies returning arrays and passing them as arguments */
template <typename Type, int VecElems>
struct VecArg {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Nyrio could you add an issue about this, so that we don't forget it?

cpp/test/linalg/matrix_vector_op.cu Show resolved Hide resolved
@Nyrio Nyrio requested a review from cjnolet November 8, 2022 17:45
@Nyrio Nyrio requested a review from tfeher November 8, 2022 18:16
@Nyrio
Copy link
Contributor Author

Nyrio commented Nov 8, 2022

@tfeher The last commit is for you. Re-requesting a review, so you can have a quick look at the new int8_t/float test.

@Nyrio Nyrio assigned cjnolet and tfeher and unassigned Nyrio Nov 8, 2022
@cjnolet
Copy link
Member

cjnolet commented Nov 8, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 1923c87 into rapidsai:branch-22.12 Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review cpp improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

5 participants