Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/matx/core/sparse_tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class sparse_tensor_t
// A direct sparse tensor assignment (viz. (Acoo = ...).exec();).
template <typename T>
[[nodiscard]] __MATX_INLINE__ __MATX_HOST__ auto operator=(const T &op) {
[[maybe_unused]] typename T::dense2sparse_xform_op valid = true;
[[maybe_unused]] typename T::tosparse_xform_op valid = true;
return detail::sparse_set(*this, op);
}

Expand Down
4 changes: 2 additions & 2 deletions include/matx/operators/dense2sparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Dense2SparseOp : public BaseOp<Dense2SparseOp<OpA>> {
public:
using matxop = bool;
using matx_transform_op = bool;
using dense2sparse_xform_op = bool;
using tosparse_xform_op = bool;
using value_type = typename OpA::value_type;

__MATX_INLINE__ Dense2SparseOp(const OpA &a) : a_(a) {}
Expand All @@ -71,7 +71,7 @@ class Dense2SparseOp : public BaseOp<Dense2SparseOp<OpA>> {
if constexpr (is_sparse_tensor_v<OpA>) {
MATX_THROW(matxNotSupported, "Cannot use dense2sparse on sparse input");
} else {
// NOTE: sparse assignment A = dense2sparse(B) takes direct reference!
// NOTE: sparse assignment O = dense2sparse(A) takes direct reference!
if constexpr (is_sparse_tensor_v<Out>) {
dense2sparse_impl(out, a_, ex);
} else {
Expand Down
32 changes: 16 additions & 16 deletions include/matx/transforms/convert/dense2sparse_cusparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
/////////////////////////////////////////////////////////////////////////////////

#pragma once
Expand All @@ -51,7 +52,6 @@ struct Dense2SparseParams_t {
MatXDataType_t dtype;
MatXDataType_t ptype;
MatXDataType_t ctype;
int rank;
cudaStream_t stream;
index_t m;
index_t n;
Expand All @@ -71,7 +71,8 @@ __MATX_INLINE__ static auto makeDefaultNonOwningStorage(size_t sz,
if (sz != 0) {
matxAlloc(reinterpret_cast<void **>(&ptr), sz * sizeof(T), space, stream);
}
raw_pointer_buffer<T, matx_allocator<T>> buf{ptr, sz * sizeof(T), /*owning=*/false};
raw_pointer_buffer<T, matx_allocator<T>> buf{ptr, sz * sizeof(T),
/*owning=*/false};
return basic_storage<decltype(buf)>{std::move(buf)};
}

Expand Down Expand Up @@ -188,7 +189,6 @@ class Dense2SparseHandle_t {
params.dtype = TypeToInt<VAL>();
params.ptype = TypeToInt<POS>();
params.ctype = TypeToInt<CRD>();
params.rank = a.Rank();
params.stream = stream;
// TODO: simple no-batch, row-wise, no-transpose for now
params.m = a.Size(TensorTypeA::Rank() - 2);
Expand Down Expand Up @@ -235,16 +235,16 @@ struct Dense2SparseParamsKeyHash {
};

/**
* Test SOLVE parameters for equality. Unlike the hash, all parameters must
* match exactly to ensure the hashed kernel can be reused for the computation.
* Test Dense2Sparse parameters for equality. Unlike the hash, all parameters
* must match exactly to ensure the hashed kernel can be reused for the
* computation.
*/
struct Dense2SparseParamsKeyEq {
bool operator()(const Dense2SparseParams_t &l,
const Dense2SparseParams_t &t) const noexcept {
return l.dtype == t.dtype && l.ptype == t.ptype && l.ctype == t.ctype &&
l.rank == t.rank && l.stream == t.stream && l.m == t.m &&
l.n == t.n && l.ptrO1 == t.ptrO1 && l.ptrO2 == t.ptrO2 &&
l.ptrA == t.ptrA;
l.stream == t.stream && l.m == t.m && l.n == t.n &&
l.ptrO1 == t.ptrO1 && l.ptrO2 == t.ptrO2 && l.ptrA == t.ptrA;
}
};

Expand Down
33 changes: 16 additions & 17 deletions include/matx/transforms/convert/sparse2dense_cusparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
/////////////////////////////////////////////////////////////////////////////////

#pragma once
Expand All @@ -51,7 +52,6 @@ struct Sparse2DenseParams_t {
MatXDataType_t dtype;
MatXDataType_t ptype;
MatXDataType_t ctype;
int rank;
cudaStream_t stream;
index_t nse;
index_t m;
Expand Down Expand Up @@ -140,7 +140,6 @@ class Sparse2DenseHandle_t {
params.dtype = TypeToInt<typename TensorTypeA::val_type>();
params.ptype = TypeToInt<typename TensorTypeA::pos_type>();
params.ctype = TypeToInt<typename TensorTypeA::crd_type>();
params.rank = a.Rank();
params.stream = stream;
// TODO: simple no-batch, row-wise, no-transpose for now
params.nse = a.Nse();
Expand Down Expand Up @@ -189,17 +188,17 @@ struct Sparse2DenseParamsKeyHash {
};

/**
* Test SOLVE parameters for equality. Unlike the hash, all parameters must
* match exactly to ensure the hashed kernel can be reused for the computation.
* Test Sparse2Dense parameters for equality. Unlike the hash, all parameters
* must match exactly to ensure the hashed kernel can be reused for the
* computation.
*/
struct Sparse2DenseParamsKeyEq {
bool operator()(const Sparse2DenseParams_t &l,
const Sparse2DenseParams_t &t) const noexcept {
return l.dtype == t.dtype && l.ptype == t.ptype && l.ctype == t.ctype &&
l.rank == t.rank && l.stream == t.stream && l.nse == t.nse &&
l.m == t.m && l.n == t.n && l.ptrA0 == t.ptrA0 &&
l.ptrA1 == t.ptrA1 && l.ptrA2 == t.ptrA2 && l.ptrA3 == t.ptrA3 &&
l.ptrA4 == t.ptrA4 && l.ptrO == t.ptrO;
l.stream == t.stream && l.nse == t.nse && l.m == t.m && l.n == t.n &&
l.ptrA0 == t.ptrA0 && l.ptrA1 == t.ptrA1 && l.ptrA2 == t.ptrA2 &&
l.ptrA3 == t.ptrA3 && l.ptrA4 == t.ptrA4 && l.ptrO == t.ptrO;
}
};

Expand Down Expand Up @@ -227,7 +226,7 @@ void sparse2dense_impl(OutputTensorType &O, const InputTensorType &a,
MATX_NVTX_START("", matx::MATX_NVTX_LOG_API)
const auto stream = exec.getStream();

// Transform into supported form.
// Transform into supported form.
auto o = getS2DSupportedTensor(O, stream);

using atype = InputTensorType;
Expand Down
4 changes: 1 addition & 3 deletions include/matx/transforms/solve/solve_cudss.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ struct SolveCUDSSParams_t {
MatXDataType_t dtype;
MatXDataType_t ptype;
MatXDataType_t ctype;
int rank;
cudaStream_t stream;
index_t nse;
index_t m;
Expand Down Expand Up @@ -141,7 +140,6 @@ class SolveCUDSSHandle_t {
params.dtype = TypeToInt<typename TensorTypeA::val_type>();
params.ptype = TypeToInt<typename TensorTypeA::pos_type>();
params.ctype = TypeToInt<typename TensorTypeA::crd_type>();
params.rank = c.Rank();
params.stream = stream;
// TODO: simple no-batch, row-wise, no-transpose for now
params.nse = a.Nse();
Expand Down Expand Up @@ -209,7 +207,7 @@ struct SolveCUDSSParamsKeyEq {
bool operator()(const SolveCUDSSParams_t &l,
const SolveCUDSSParams_t &t) const noexcept {
return l.dtype == t.dtype && l.ptype == t.ptype && l.ctype == t.ctype &&
l.rank == t.rank && l.stream == t.stream && l.nse == t.nse &&
l.stream == t.stream && l.nse == t.nse &&
l.m == t.m && l.n == t.n && l.k == t.k && l.ptrA0 == t.ptrA0 &&
l.ptrA1 == t.ptrA1 && l.ptrA2 == t.ptrA2 && l.ptrA3 == t.ptrA3 &&
l.ptrA4 == t.ptrA4 && l.ptrB == t.ptrB && l.ptrC == t.ptrC;
Expand Down