-
Notifications
You must be signed in to change notification settings - Fork 915
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
Disable column_view data accessors for unsupported types #7725
Disable column_view data accessors for unsupported types #7725
Conversation
Scatter was erroneously instantiating things like column_view::begin<struct_view>(). Updated the specializations to ensure that unsupported types throw an exception.
list scatter was incorrectly instantiating column_view::data<decimal32>. This should be fixed by just using the storage type dispatcher instead.
is_rep_layout_compatible is used to describe types that are safe to use with column_view accessors.
The following tests are now failing as a result of this change:
I suspect this is all due to the erroneous code paths taken in the JIT code. |
So the cudf/cpp/src/binaryop/binaryop.cpp Line 620 in 20509d0
which calls into: cudf/cpp/src/binaryop/binaryop.cpp Lines 226 to 230 in 20509d0
which calls get_data_ptr<decimal32/64> cudf/cpp/src/binaryop/binaryop.cpp Lines 248 to 251 in 20509d0
and in my PR, that lands you here: Lines 36 to 41 in f99318e
The binop API only knows how to access data through the |
get_data_ptr was erroneously invoking column_view::data<decimal32/64>(). As it happens, this ended up being okay when the column did not have any offset as column_view::data<int32>() and column_view::data<decimal32>() will return the same initial pointer when the offset is zero. The problem occurs when you attempt to advance this pointer, or if the column had an offset (which internally will advance the pointer).
The fix in a4788a0 was to just use |
Codecov Report
@@ Coverage Diff @@
## branch-0.19 #7725 +/- ##
===============================================
+ Coverage 81.86% 82.52% +0.65%
===============================================
Files 101 101
Lines 16884 17458 +574
===============================================
+ Hits 13822 14407 +585
+ Misses 3062 3051 -11
Continue to review full report at Codecov.
|
This test should not be testing the kernel directly.
I'm calling this "non-breaking" in that it doesn't change any external APIs. It technically could change externally visible behavior where some code will throw where it used to "work", but those use cases were broken code to begin with. |
@@ -31,6 +31,7 @@ | |||
#include <type_traits> | |||
#include "../fixture/benchmark_fixture.hpp" | |||
#include "../synchronization/synchronization.hpp" | |||
#include "cudf/utilities/traits.hpp" |
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.
Nitpick: Aren't we enforcing angle brackets <>
for includes that aren't in the current directory?
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.
Ah, something in my vscode auto includes headers and uses "
instead of <>
. I'll need to see if I can change that.
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.
It's clangd IWYU.
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.
nice!
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.
Looks good to me. One request (if you don't want to do it then just re-request my review and I can approve): it seems like there are a number of places in this PR that are still using the raw std::enable_if_t<...>* = nullptr
to disable implementations (where it's using an non-type template parameter that's unused AFAICT). Since any code patterns introduced here will inevitably be copied into other places and your new CUDF_ENABLE_IF
macro is a bit cleaner, it would be nice to use it consistently everywhere as much as possible.
Co-authored-by: Paul Taylor <[email protected]>
Yeah, I got half way through and got sick of typing, so I made the macro. I was hoping reviewers would just let me be lazy :) But I agree, I'll go make stuff in this PR consistent. |
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.
Looks awesome! Small header things but not a big deal.
cpp/tests/copying/copy_tests.cu
Outdated
@@ -28,6 +28,7 @@ | |||
#include <cudf/scalar/scalar.hpp> | |||
|
|||
#include <rmm/cuda_stream_view.hpp> | |||
#include "cudf/utilities/traits.hpp" |
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.
#include "cudf/utilities/traits.hpp" | |
#include <cudf/utilities/traits.hpp> |
… into disable_column_view_begin
Co-authored-by: Conor Hoekstra <[email protected]>
Co-authored-by: Conor Hoekstra <[email protected]>
… into disable_column_view_begin
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.
Looks good!
@gpucibot merge |
In #7725 I updated some of the fall through error cases to use old, [C-style ellipsis variadics ](https://github.com/jrhemstad/cudf/blob/f92d4626c7a4296075c5aa6240d6e3b88049abe6/cpp/include/cudf/detail/gather.cuh#L145 )since we don't care about the parameters in the error case. Turns out C++ forbids passing "non-POD" types through this kind of variadic ellipsis, which ends up generating a compiler warning: > warning: non-POD class type passed through ellipsis Authors: - Jake Hemstad (https://github.com/jrhemstad) Approvers: - David Wendt (https://github.com/davidwendt) - Nghia Truong (https://github.com/ttnghia) - Mark Harris (https://github.com/harrism) URL: #7781
Fixes #7712
column_view
provides data accessors likecolumn_view::data<T>
andcolumn_view::begin<T>
. These accessors are only valid for fixed-width primitive types that can be constructed by simply casting the underlyingvoid*
toT*
.However, the accessors never actually enforced this rule, e.g.,
column_view::data<struct_view>
should fail to compile.This PR disables these accessors for invalid types.
This uncovered a number of places that were erroneously instantiating
column_view
accessors, which would lead to silent failures (e.g.,scatter
was failing silently forstruct
columns).I added a few new things to aid me in this effort:
CUDF_ENABLE_IF
macro to make it easier to SFINAE.is_rep_layout_compatbile<T>()
to identify types that are layout compatible with their rep (e.g.,duration_ns
is layout compatible with itsint64_t
rep. Thedecimal32
type is not layout compatible with it'sint32_t
rep).column_device_view::has_element_accessor<T>()
identifies ifcolumn_device_view::element<T>()
has a valid overload.