Conversation
| Uint64, | ||
| Float32, | ||
| Float64, | ||
| Bool, |
There was a problem hiding this comment.
doesn't this Bool entity need to actually exist under the hood??
There was a problem hiding this comment.
not for the enum, this basically is just a definition
include/traits.hpp
Outdated
| typedef uint8_t bool_t; | ||
|
|
There was a problem hiding this comment.
please if you do use using bool_t = uint8_t
| Uint64, | ||
| Float32, | ||
| Float64, | ||
| Bool, |
There was a problem hiding this comment.
not for the enum, this basically is just a definition
|
Based on feedback from Jakob, I pushed in a small change to switch back to compiling with genuine Each of those failures look pretty similar--one example: |
f5d66e6 to
d5c85c6
Compare
|
Ok, tests are passing locally now with the "native" I think they make sense--basically any positive non-zero integer value should be considered |
|
Looks like a subset of CI CMake builds fail with: |
|
Easy fix, in include/variants/atomics.hpp: Exclude all meaningless/invalid arithmetic operations on booleans via an _atomic.def(
"__mul__", [](atomic_type _obj, value_type _v) { return (_obj * _v); },
py::is_operator());should be: constexpr bool is_boolean = std::is_same<Tp, bool>::value;
if constexpr(!is_boolean) {
_atomic.def(
"__mul__", [](atomic_type _obj, value_type _v) { return (_obj * _v); },
py::is_operator());
// ... etc
} |
| if _kwargs["dtype"] == kokkos.bool: | ||
| self.assertEqual(_data[1].create_mirror_view()[_idx], True) | ||
| else: | ||
| self.assertEqual(_data[1].create_mirror_view()[_idx], 2) |
There was a problem hiding this comment.
| if _kwargs["dtype"] == kokkos.bool: | |
| self.assertEqual(_data[1].create_mirror_view()[_idx], True) | |
| else: | |
| self.assertEqual(_data[1].create_mirror_view()[_idx], 2) | |
| value = lambda v : v if _kwargs["dtype"] != kokkos.bool else v > 0 | |
| self.assertEqual(_data[1].create_mirror_view()[_idx], value(2)) |
Just thought this scheme would be easier to maintain + more compact
|
I think >>> import numpy as np
>>> np.array([True, True]) * np.array([False, False])
array([False, False])If C++ doesn't allow it, I suppose we could disable it here and use casting in the ufunc inner loops in |
|
@tylerjereddy sorry, disregard that statement. I saw something suggesting the compiler was trying to use |
|
I don't think this is necessarily an error. It is failing to build bc of #if defined(__GNUC__) // GCC and clang
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#endif
// affected regions within generate_atomic_variant
#if defined(__GNUC__) // GCC and clang
#pragma GCC diagnostic pop
#endif |
|
Maybe I don't understand, but what would a multiplication of bools look like? I guess if you want to do this in cpp it will implicitly cast it to int, multiply and then cast it back ... which is the same as doing |
|
And if this is not possible, why not |
This would be ideal, I was under the impression from looking at the lambdas that |
Agree in principal but you would need a partial specialization and this is a freestanding function |
|
Oh wait nevermind, I remember seeing C++17 or higher is a requirement for Kokkos now so an if constexpr would work. |
* I need a bool type for Python array API standard conformance, and as far as I know Kokkos doesn't work with such a view type under the hood? * if I alias `bool_` and `bool` to the `uint8` type, the conformance test suite can see through it, and resolves the alias and fails my suite * I'm trying another approach now, but this fails i.e., the local `pykokkos-base` testsuite with ``` AttributeError: module 'kokkos.libpykokkos' has no attribute 'KokkosView_bool_HostSpace_LayoutRight_1' ``` * I'm not so sure either of these approaches really have many prospects for success--I'm open to better ideas... [skip ci]
* compile using genuine `bool` type instead of an alias * this seems to succeed at build stage, but a few tests do fail at the moment [skip ci]
* to accommodate `bool` view type, we use `True` instead of actual integer values in a number of tests
39f1f41 to
86e2856
Compare
|
I force pushed after a rebase o see if this still works with the Kokkos 4.7.01. |
that is a legit problem ... And we need to check why the rest of the CI did not catch that. |
I need a bool type for Python array API standard
conformance, and as far as I know Kokkos doesn't work
with such a view type under the hood?
if I alias
bool_andboolto theuint8type,the conformance test suite can see through it, and
resolves the alias and fails my suite
I'm trying another approach now, but this fails
i.e., the local
pykokkos-basetestsuite withprospects for success--I'm open to better ideas...
[skip ci]