CUTLASS v1.0 release

This commit is contained in:
akerr
2018-05-16 11:44:56 -07:00
parent 901287175f
commit 2028ebe120
1830 changed files with 308993 additions and 11173 deletions
+96
View File
@@ -0,0 +1,96 @@
# Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
# * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include_directories(
../../external/googletest/googletest
.
)
link_directories(
../../external/googletest/googletest
)
link_libraries(
gtest
)
set(CUTLASS_UNIT_TEST_HEADERS
cutlass_unit_test.h
core/layout_verification.h
)
set(CUTLASS_UNIT_TEST_SOURCES
cutlass_unit_test.cpp
util/host_tensor.cu
core/layout_verification.cu
core/predicate_vector.cu
core/tile_iterator.cu
gemm/dgemm.cu
gemm/hgemm_128x128x8.cu
gemm/hgemm_128x32x8.cu
gemm/hgemm_128x64x8.cu
gemm/igemm_128x128x32.cu
gemm/igemm_128x64x32.cu
gemm/igemm_128x32x32.cu
gemm/igemm_128x128x32_float.cu
gemm/igemm_128x128x32_int8.cu
gemm/sgemm_128x128x8.cu
gemm/sgemm_128x64x8.cu
gemm/sgemm_128x32x8.cu
gemm/sgemm_64x128x8.cu
gemm/sgemm_64x64x8.cu
gemm/sgemm_64x32x8.cu
gemm/wmma_gemm.cu
)
if (CUTLASS_NVRTC_ENABLE)
list(APPEND CUTLASS_UNIT_TEST_SOURCES gemm/gemm_nvrtc.cu)
endif()
source_group("Source\ Files" FILES ${CUTLASS_UNIT_TEST_SOURCES})
if (NOT CUTLASS_NATIVE_CUDA)
# cuda_add_executable does not take interface include directories into account
# Let's fetch them and pass them to CUDA.
get_target_property(CUTLASS_INCLUDES CUTLASS INTERFACE_INCLUDE_DIRECTORIES)
include_directories("${CUTLASS_INCLUDES}")
endif()
cutlass_add_executable(
cutlass_unit_test
${CUTLASS_UNIT_TEST_SOURCES}
${CUTLASS_UNIT_TEST_HEADERS}
)
if (CUTLASS_NVRTC_ENABLE)
target_link_libraries(cutlass_unit_test
cutlass_nvrtc
cuda
)
if (WIN32)
target_link_libraries(cutlass_unit_test Dbghelp)
endif()
endif()
CUDA_ADD_CUBLAS_TO_TARGET(cutlass_unit_test)
+194
View File
@@ -0,0 +1,194 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <algorithm>
#include <tools/test/unit/core/layout_verification.h>
namespace test {
Layout::Layout() {
}
Layout::Layout(Layout::SpanVector const &_layout) {
reset(_layout);
}
struct SpanCompareDim {
bool operator()(Layout::Span const &a, Layout::Span const &b) const {
return a.dim < b.dim;
}
};
/// Updates the layout
void Layout::reset(Layout::SpanVector const &_layout) {
layout_ = _layout;
extent_.clear();
extent_.resize(layout_.size(), 1);
int _rank = std::max_element(layout_.begin(), layout_.end(), SpanCompareDim())->dim + 1;
dim_extent_.clear();
dim_extent_.resize(_rank, extent_);
// initialize extent vector
for (size_t i = layout_.size(); i > 0; --i) {
extent_.at(i - 1) = layout_.at(i - 1).size * (i < layout_.size() ? extent_.at(i) : 1);
}
// initialize the dim_extent vector
for (size_t rank_idx = 0; rank_idx < dim_extent_.size(); ++rank_idx) {
ExtentVector &_extent = dim_extent_.at(rank_idx);
for (size_t i = layout_.size(); i > 0; --i) {
int _size = (rank_idx == layout_.at(i - 1).dim ? layout_.at(i - 1).size : 1);
_extent.at(i - 1) = _size * (i < layout_.size() ? _extent.at(i) : 1);
}
}
}
/// Computes the rank of the layout
int Layout::rank() const {
return int(dim_extent_.size());
}
/// Prints a layout
std::ostream & Layout::write(std::ostream &out) const {
std::cout << "Layout: [";
for (size_t i = 0; i < layout_.size(); ++i) {
std::cout << "(" << layout_.at(i).dim << ": " << layout_.at(i).size << ") ";
}
std::cout << "] - rank: " << rank() << "\n";
std::cout << "Extent: [";
for (size_t i = 0; i < layout_.size(); ++i) {
std::cout << (i ? ", " : "") << extent_.at(i);
}
std::cout << "]\n";
for (size_t r = 0; r < dim_extent_.size(); ++r) {
std::cout << " Dim " << r << ": [";
for (int i = 0; i < dim_extent_.at(r).size(); ++i) {
std::cout << (i ? ", " : "") << dim_extent_.at(r).at(i);
}
std::cout << "]\n";
}
return out;
}
/// Maps an index to a given coordinate
Layout::Coordinate Layout::operator()(int index) const {
Coordinate coord(rank(), 0);
for (size_t i = 0; i < layout_.size() - 1; ++i) {
int quotient = (index / extent_.at(i + 1));
index = (index % extent_.at(i + 1));
coord.at(layout_.at(i).dim) += quotient * dim_extent_.at(layout_.at(i).dim).at(i + 1);
}
coord.at(layout_.back().dim) += index;
return coord;
}
/// Maps a coordinate to an index
int Layout::operator()(Layout::Coordinate const &_coord) const {
Coordinate coord(_coord);
int index = 0;
for (size_t i = layout_.size(); i > 0; --i) {
size_t idx = i - 1;
int dim = layout_.at(idx).dim;
int size = layout_.at(idx).size;
int items = coord.at(dim);
int quotient = items / size;
int remainder = items % size;
index += remainder * (i < layout_.size() ? extent_.at(idx + 1) : 1);
coord.at(dim) = quotient;
}
return index;
}
}
std::ostream & operator<<(std::ostream &out, test::Layout::Coordinate const &coord) {
for (int i = 0; i < coord.size(); ++i) {
out << (i ? ", " : "") << coord.at(i);
}
return out;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Layout, igemm) {
test::Layout::SpanVector layout_def;
typedef test::Layout::Span Span;
layout_def.push_back(Span(0, 8));
layout_def.push_back(Span(1, 4));
layout_def.push_back(Span(0, 4));
test::Layout layout(layout_def);
for (int i = 0; i < 33; ++i) {
test::Layout::Coordinate coord = layout(i);
int index = layout(coord);
EXPECT_EQ(i, index)
<< "[" << i << "] - (" << layout(i) << ") => " << layout(layout(i)) << std::endl;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Layout, sgemm_accum) {
test::Layout::SpanVector layout_def;
typedef test::Layout::Span Span;
layout_def.push_back(Span(0, 2));
layout_def.push_back(Span(1, 8));
layout_def.push_back(Span(0, 2));
test::Layout layout(layout_def);
for (int i = 0; i < 32; ++i) {
test::Layout::Coordinate coord = layout(i);
int index = layout(coord);
EXPECT_EQ(i, index)
<< "[" << i << "] - (" << layout(i) << ") => " << layout(layout(i)) << std::endl;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
+314
View File
@@ -0,0 +1,314 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (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
#include <functional>
#include <iosfwd>
#include <iostream>
#include <vector>
#include <cutlass/tensor_view.h>
#include <tools/util/half.h>
#include <tools/util/host_tensor_view.h>
#include <tools/util/tensor_view_io.h>
#include <tools/util/type_traits.h>
namespace test {
/// Defines an arrangement
class Layout {
public:
/// Analogous to cutlass::Span
struct Span {
int dim;
int size;
Span(int _dim = 0, int _size = 0) : dim(_dim), size(_size) {}
};
/// Vector of span definitions
typedef std::vector<Span> SpanVector;
/// Coordinate in an arbitrary-dimensional space
typedef std::vector<int> Coordinate;
/// Defines a vector describing the extent of some dimension
typedef std::vector<int> ExtentVector;
private:
/// Defines a mapping from a 1D sequence to an n-dimensional space
SpanVector layout_;
/// Computes the extent of each node in the layout description
ExtentVector extent_;
/// For each dimension, computes extent
std::vector<ExtentVector> dim_extent_;
public:
//
// Methods
//
Layout();
Layout(SpanVector const& _layout);
/// Updates the layout
void reset(SpanVector const& _layout = SpanVector());
/// Computes the rank of the layout
int rank() const;
/// Prints Layout data structure
std::ostream& write(std::ostream& out) const;
/// Maps an index to a given coordinate
Coordinate operator()(int index) const;
/// Maps a coordinate to an index
int operator()(Coordinate const& coord) const;
};
}
/// Implemented in layout_verification.cu
std::ostream& operator<<(std::ostream& out, test::Layout::Coordinate const& coord);
namespace test {
/// Packs the elements of a coordinate into the bits available
template <typename T, int Rank = 2>
struct CoordinatePack {
typedef T value_type;
typedef typename cutlass::TypeTraits<T>::unsigned_type Bits;
static int const ElementBits = sizeof(Bits) * 8 / Rank;
static Bits const Mask = (Bits(1) << ElementBits) - 1;
Bits operator()(Layout::Coordinate const& coord) const {
Bits result = 0;
for (size_t i = 0; i < coord.size(); ++i) {
result |= (((coord.at(i) & Mask) << (i * ElementBits)));
}
return result;
}
};
/// Unpacks a coordinate from the bits available
template <typename T, int Rank = 2>
struct CoordinateUnpack {
typedef T value_type;
typedef typename cutlass::TypeTraits<T>::unsigned_type Bits;
static int const ElementBits = sizeof(Bits) * 8 / Rank;
static Bits const Mask = (Bits(1) << ElementBits) - 1;
Layout::Coordinate operator()(Bits index) const {
Layout::Coordinate coord(Rank, 0);
for (size_t i = 0; i < Rank; ++i) {
coord.at(i) = (index & Mask);
index = (index >> ElementBits);
}
return coord;
}
};
/// Hashing function
struct HashUint64 {
// PJW Elf Hash - https://en.wikipedia.org/wiki/PJW_hash_function
uint64_t operator()(uint64_t value) const {
uint64_t h = 0;
uint64_t high;
uint8_t const* s = reinterpret_cast<uint8_t const*>(&value);
for (int byte = 0; byte < sizeof(value); ++byte) {
h = (h << 4) + *s++;
if (high = (h & 0xF0000000)) {
h ^= high >> 24;
}
h &= ~high;
}
return h;
}
};
/// Packs the coordinate into 64 bits then hashes the result and stores the least significant bits
template <typename T, typename Hasher = HashUint64>
struct CoordinateHash {
typedef T value_type;
typedef typename cutlass::TypeTraits<T>::unsigned_type Bits;
typedef CoordinatePack<uint64_t, 4> Pack;
/// Bit mask to cast from uint64_t to whatever Bits is
static uint64_t const mask = ((uint64_t(1) << (sizeof(Bits) * 8)) - 1);
static_assert(sizeof(Bits) <= sizeof(uint64_t), "T must be smaller than or equal to uint64_t");
//
// Data members
//
/// Packs coordinate into uint64_t
Pack pack;
/// Hashes the resulting coordinate
Hasher hasher;
/// One additional xor to salt things
uint64_t salt;
//
//
//
CoordinateHash(uint64_t _salt = 0x0ac7d0190) : salt(_salt) {}
/// Returns a hashed coordinate
Bits operator()(Layout::Coordinate const& coord) const {
uint64_t result = hasher(pack(coord) ^ salt);
return Bits(result & mask);
}
};
/// Environment to initialize and verify a template
template <typename DestType_,
typename DestCoordinateHash_,
typename SourceType_,
typename SourceCoordinateHash_>
class VerifyLayout {
public:
typedef DestType_ DestType;
typedef typename cutlass::TypeTraits<DestType>::unsigned_type DestBits;
typedef DestCoordinateHash_ DestCoordinateHash;
typedef SourceType_ SourceType;
typedef typename cutlass::TypeTraits<SourceType>::unsigned_type SourceBits;
typedef SourceCoordinateHash_ SourceCoordinateHash;
public:
/// Basic visitor to terminate verification on error
struct VisitorNop {
/// Returns true to keep checking in spite of errors, false if to stop
bool operator()(DestBits got, // hashed/packed coordinate encountered
DestBits expected, // hashed/packed coordinate expected
Layout::Coordinate coord, // computed coordinate
int index) { // location
// false to terminate checking
return false;
}
};
/// Basic visitor to terminate verification on error
struct VisitorVerbose {
CoordinateUnpack<DestBits> unpack;
std::ostream* out;
VisitorVerbose() : out(&std::cout) {}
VisitorVerbose(std::ostream& _out) : out(&_out) {}
/// Returns true to keep checking in spite of errors, false if to stop
bool operator()(DestBits got, // hashed/packed coordinate encountered
DestBits expected, // hashed/packed coordinate expected
Layout::Coordinate coord, // computed coordinate
int index) { // location
int const width = sizeof(DestBits) * 2;
(*out) << "[" << index << "] - (" << coord << ") - expected: 0x" << std::hex
<< std::setw(width) << std::setfill('0') << expected << ", got: 0x" << std::setw(width)
<< std::setfill('0') << got << std::dec << " - unpacked: (" << unpack(got) << ")"
<< std::endl;
// true to print out complete error report
return true;
}
};
public:
VerifyLayout() {}
/// Initializes memory according to a layout and hash function
void initialize(cutlass::HostTensorView<SourceType> const& source, Layout const& layout) {
SourceCoordinateHash hash;
int const count = source.size().count();
SourceBits* data = reinterpret_cast<SourceBits*>(source.ref().data());
for (int index = 0; index < count; ++index) {
SourceBits element = hash(layout(index));
data[index] = element;
}
}
/// Verifies the resulting layout
template <typename Visitor>
bool verify(cutlass::HostTensorView<DestType> const& dest,
Layout const& layout,
Visitor visitor) {
DestCoordinateHash hash;
int const count = dest.size().count();
DestBits* data = reinterpret_cast<DestBits*>(dest.ref().data());
int errors = 0;
for (int index = 0; index < count; ++index) {
Layout::Coordinate coord = layout(index);
DestBits element = hash(coord);
if (element != data[index]) {
++errors;
if (!visitor(data[index], element, coord, index)) {
break;
}
}
}
return !errors;
}
/// Verifies the resulting layout
bool verify(cutlass::HostTensorView<DestType> const& dest, Layout const& layout) {
return verify(layout, VisitorNop());
}
};
} // namespace test
+120
View File
@@ -0,0 +1,120 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cublas_v2.h>
#include <cstring>
#include <cutlass_unit_test.h>
#include <cutlass/predicate_vector.h>
#include <tools/util/host_tensor.h>
namespace test {
template <typename PredicateVector>
__global__ void load_predicates(unsigned *output, unsigned const *input) {
PredicateVector predicates;
int const word_count = (PredicateVector::kPredicates + 31) / 32;
int i = 0;
for (int word_idx = 0; word_idx < word_count; ++word_idx) {
unsigned word = input[word_idx];
CUTLASS_PRAGMA_UNROLL
for (int bit = 0; bit < sizeof(unsigned) * 8; ++bit) {
bool pred = ((word >> bit) & 1);
predicates.set(i, pred);
if (predicates.at(i) != pred) {
printf("ERROR - cannot read back predicate\n");
}
++i;
}
}
__syncthreads();
i = 0;
for (int word_idx = 0; word_idx < word_count; ++word_idx) {
unsigned result = 0;
for (int bit = 0; bit < sizeof(unsigned) * 8; ++bit) {
bool pred = predicates.at(i ++);
result |= (unsigned(pred) << bit);
}
output[word_idx] = result;
}
}
}
TEST(PredicateVector, Basic) {
static int const Bits = 32;
static int const Words = (Bits + 31) / 32;
typedef cutlass::PredicateVector<Bits> PredicateVector;
cutlass::HostTensor<unsigned> output;
cutlass::HostTensor<unsigned> input;
output.resize(Words);
input.resize(Words);
// some arbitrary test bits
unsigned values[] = {
0xdeadbeef,
0xa0070032,
0x9076d001,
0x00000000,
0xabdfc0ad
};
for (int test = 0; test < 5; ++test) {
input[0] = values[test];
output[0] = 0;
input.sync_device();
output.sync_device();
test::load_predicates<PredicateVector><<<
dim3(1,1,1), dim3(1,1,1)
>>>(
output.device_data(),
input.device_data()
);
output.sync_host();
for (int word = 0; word < Words; ++word) {
EXPECT_EQ(input[word], output[word])
<< "Expected: 0x" << std::hex << input.host_data()[word]
<< ", got: 0x" << output.host_data()[word]
<< std::dec;
}
}
}
+153
View File
@@ -0,0 +1,153 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <tools/util/host_tensor.h>
#include <tools/util/tensor_view_io.h>
#include <cutlass/shape.h>
#include <cutlass/predicate_vector.h>
#include <cutlass/tile_iterator.h>
#include <cutlass/tile_traits_standard.h>
#include <cutlass/iterator_access.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace test {
template <typename Traits, typename Scalar>
__global__ void load_store_global(
typename cutlass::TileLoadIterator<Traits, Scalar, cutlass::IteratorAdvance::kH,
cutlass::MemorySpace::kGlobal>::Scalar const *input,
typename cutlass::TileStoreIterator<Traits, Scalar, cutlass::IteratorAdvance::kH,
cutlass::MemorySpace::kGlobal>::Scalar *output
) {
typedef cutlass::TileLoadIterator<Traits, Scalar, cutlass::IteratorAdvance::kH, cutlass::MemorySpace::kGlobal> LoadIterator;
typedef cutlass::TileStoreIterator<Traits, Scalar, cutlass::IteratorAdvance::kH, cutlass::MemorySpace::kGlobal> StoreIterator;
typename LoadIterator::Params load_params;
typename StoreIterator::Params store_params;
typedef typename Traits::Tile Tile;
load_params.initialize(input, Tile::kH*Tile::kW, Tile::kW, 1);
store_params.initialize(output, Tile::kH*Tile::kW, Tile::kW, 1);
LoadIterator load_iterator(load_params);
StoreIterator store_iterator(store_params);
typename LoadIterator::Fragment fragment;
load_iterator.load(fragment);
store_iterator.store(fragment);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(TileIterator, tile_128x8_contiguous) {
static int const M = 128;
static int const N = 1;
static int const K = 8;
static int const kThreads = M;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::TileTraitsStandard<cutlass::Shape<N, K, M>, kThreads> Traits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kW, 1));
output.fill(0);
test::load_store_global< Traits, float ><<<
dim3(1,1,1),
dim3(kThreads, 1)
>>>(
input.device_data(),
output.device_data()
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(TileIterator, tile_128x8_rake) {
static int const M = 128;
static int const N = 1;
static int const K = 8;
static int const kThreads = 32;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::TileTraitsStandard<cutlass::Shape<N, K, M>, kThreads> Traits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kW, 1));
output.fill(0);
test::load_store_global< Traits, float ><<<
dim3(1,1,1),
dim3(kThreads, 1)
>>>(
input.device_data(),
output.device_data()
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
+34
View File
@@ -0,0 +1,34 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
/** \file
\brief CUTLASS Unit Tests
*/
#include <gtest/gtest.h>
int main(int argc, char* arg[]) {
::testing::InitGoogleTest(&argc, arg);
return RUN_ALL_TESTS();
}
+30
View File
@@ -0,0 +1,30 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (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
#pragma diag_suppress boolean_controlling_expr_is_constant
#include <gtest/gtest.h>
#pragma diag_warning boolean_controlling_expr_is_constant
+340
View File
@@ -0,0 +1,340 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cublas_v2.h>
#include <cstring>
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/dgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x32x8, dgemm_64x32x8_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 32, 8);
}
TEST(Dgemm_64x32x8, dgemm_256x128x64_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x64x8, dgemm_64x64x8_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 64, 8);
}
TEST(Dgemm_64x64x8, dgemm_256x128x64_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x32x8, dgemm_128x32x8_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 32, 8);
}
TEST(Dgemm_128x32x8, dgemm_256x64x64_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x128x8, dgemm_128x128x8_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 128, 8);
}
TEST(Dgemm_128x128x8, dgemm_512x256x64_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(512, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DGEMM Column-Column
//
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x32x8, dgemm_64x32x8_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 32, 8);
}
TEST(Dgemm_64x32x8, dgemm_256x128x64_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x64x8, dgemm_64x64x8_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 64, 8);
}
TEST(Dgemm_64x64x8, dgemm_256x128x64_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x32x8, dgemm_128x32x8_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 32, 8);
}
TEST(Dgemm_128x32x8, dgemm_256x64x64_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x128x8, dgemm_128x128x8_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 128, 8);
}
TEST(Dgemm_128x128x8, dgemm_512x256x64_nn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(512, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DGEMM Row-Column
//
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x32x8, dgemm_64x32x8_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 32, 8);
}
TEST(Dgemm_64x32x8, dgemm_256x128x64_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x64x8, dgemm_64x64x8_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 64, 8);
}
TEST(Dgemm_64x64x8, dgemm_256x128x64_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x32x8, dgemm_128x32x8_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 32, 8);
}
TEST(Dgemm_128x32x8, dgemm_256x64x64_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x128x8, dgemm_128x128x8_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 128, 8);
}
TEST(Dgemm_128x128x8, dgemm_512x256x64_tn) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(512, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DGEMM Row-Row
//
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x32x8, dgemm_64x32x8_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 32, 8);
}
TEST(Dgemm_64x32x8, dgemm_256x128x64_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_64x64x8, dgemm_64x64x8_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(64, 64, 8);
}
TEST(Dgemm_64x64x8, dgemm_256x128x64_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 64> > GemmTraits;
run_gemm<GemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x32x8, dgemm_128x32x8_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 32, 8);
}
TEST(Dgemm_128x32x8, dgemm_256x64x64_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 128> > GemmTraits;
run_gemm<GemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_128x128x8, dgemm_128x128x8_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(128, 128, 8);
}
TEST(Dgemm_128x128x8, dgemm_512x256x64_tt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> > GemmTraits;
run_gemm<GemmTraits>(512, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+90
View File
@@ -0,0 +1,90 @@
/***************************************************************************************************
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass/cutlass.h>
template <typename GemmTraits_>
static void run_gemm(
int m,
int n,
int k,
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type alpha =
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type(1),
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type beta =
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type(0)) {
typedef cutlass::gemm::Gemm<GemmTraits_> Gemm;
typename Gemm::Params params;
test::GemmTestbed<
typename test::GemmTestbedTraits<
typename GemmTraits_::GemmConfig::ScalarA>::host_type, // AType
typename test::GemmTestbedTraits<
typename GemmTraits_::GemmConfig::ScalarB>::host_type, // BType
typename test::GemmTestbedTraits<
typename GemmTraits_::Epilogue::ScalarC>::host_type, // CType
typename test::GemmTestbedTraits<
typename GemmTraits_::Epilogue::Accumulators::Element>::host_type, // Accumulator
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type // Scalar
>
testbed(m,
n,
k,
cutlass::convert(GemmTraits_::kLayoutA),
cutlass::convert(GemmTraits_::kLayoutB),
alpha,
beta);
testbed.initialize();
if (testbed.has_cublas_support()) {
EXPECT_TRUE(testbed.verify_host_with_cublas());
}
params.initialize(testbed.M(),
testbed.N(),
testbed.K(),
testbed.alpha,
testbed.ptr_A(),
testbed.lda(),
testbed.ptr_B(),
testbed.ldb(),
testbed.beta,
testbed.ptr_C_initial(),
testbed.ldc(),
testbed.ptr_computed(),
testbed.ldc());
Gemm::launch(params);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
if (testbed.has_cublas_support()) {
ASSERT_TRUE(testbed.verify_with_cublas());
} else {
ASSERT_TRUE(testbed.verify_with_host());
}
}
+65
View File
@@ -0,0 +1,65 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/dgemm_traits.h>
#include <cutlass/gemm/igemm_traits.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm_nvrtc.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Dgemm_nvrtc_64x32x8, dgemm_nvrtc_64x32x8_nt) {
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 32, 64> > GemmTraits;
static char const *gemm_traits = "cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >";
run_gemm_nvrtc<GemmTraits>(gemm_traits, 64, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm__nvrtc_128x128x32, igemm_nvrtc_256x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
static char const *gemm_traits = "cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor, cutlass::MatrixLayout::kRowMajor, cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >";
run_gemm_nvrtc<IgemmTraits>(gemm_traits, 256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_nvrtc_128x128x8, sgemm_nvrtc_128x112x16_alpha2_beta1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
static char const *gemm_traits = "cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >";
run_gemm_nvrtc<SgemmTraits>(gemm_traits, 128, 112, 16, 2.f, 1.f);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+190
View File
@@ -0,0 +1,190 @@
/***************************************************************************************************
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#define NVRTC_GET_TYPE_NAME 1
#include <cutlass/cutlass.h>
#include <nvrtc.h>
#include <tools/nvrtc/cutlass/nvrtc/environment.h>
#include <string>
static inline bool check_nvrtc_error(nvrtcResult error) {
if (error != NVRTC_SUCCESS) {
std::cerr << "failed to compile ";
return false;
}
return true;
}
/// @param gemm_traits Must be the source string to generate GemmTraits_
template <typename GemmTraits_>
static __host__ void run_gemm_nvrtc(
std::string const &gemm_traits,
int m,
int n,
int k,
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type alpha =
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type(1),
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type beta =
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type(0)) {
typedef cutlass::gemm::Gemm<GemmTraits_> Gemm;
typename Gemm::Params params;
test::GemmTestbed<
typename test::GemmTestbedTraits<
typename GemmTraits_::GemmConfig::ScalarA>::host_type, // AType
typename test::GemmTestbedTraits<
typename GemmTraits_::GemmConfig::ScalarB>::host_type, // BType
typename test::GemmTestbedTraits<
typename GemmTraits_::Epilogue::ScalarC>::host_type, // CType
typename test::GemmTestbedTraits<
typename GemmTraits_::Epilogue::Accumulators::Element>::host_type, // Accumulator
typename test::GemmTestbedTraits<typename GemmTraits_::Epilogue::Scalar>::host_type // Scalar
>
testbed(m,
n,
k,
cutlass::convert(GemmTraits_::kLayoutA),
cutlass::convert(GemmTraits_::kLayoutB),
alpha,
beta);
// Instantiate gemm_kernel
nvrtcResult result_nvrtc;
nvrtcProgram program;
static char const *src =
"#include <cutlass/gemm/gemm.h>\n"
"#include <cutlass/gemm/sgemm_traits.h>\n"
"#include <cutlass/gemm/dgemm_traits.h>\n"
"#include <cutlass/gemm/igemm_traits.h>\n"
#if defined(CUTLASS_NVRTC_HAS_FP16)
"#include <cutlass/gemm/hgemm_traits.h>\n"
"#include <cutlass/gemm/wmma_gemm_traits.h>\n"
#endif
;
std::string type_name;
#if 0
// TODO Ideally we'd use nvrtcGetTypeName to determine the type, but it cannot resolve enum symbol names
// As altername solution we might want to implement to_string<GemmTraits>() to get the traits string.
nvrtcGetTypeName<typename GemmTraits_>(&type_name);
#else
type_name = gemm_traits;
#endif
result_nvrtc = nvrtcCreateProgram(&program,
src,
NULL,
(int)cutlass::nvrtc::kCutlassHeaderCount,
cutlass::nvrtc::kCutlassHeaders,
cutlass::nvrtc::kCutlassHeaderNames);
check_nvrtc_error(result_nvrtc);
std::string gemm_kernel_instantiation =
"cutlass::gemm::gemm_kernel<cutlass::gemm::Gemm< " + type_name + " > >";
nvrtcAddNameExpression(program, gemm_kernel_instantiation.c_str());
result_nvrtc = nvrtcCompileProgram(program, 0, NULL);
if (result_nvrtc != NVRTC_SUCCESS) {
size_t logSize;
nvrtcGetProgramLogSize(program, &logSize);
std::vector<char> log(logSize);
nvrtcGetProgramLog(program, log.data());
std::cout << "Compile log:" << std::endl << log.data() << std::endl;
}
if (!check_nvrtc_error(result_nvrtc)) {
ASSERT_TRUE(false);
}
// The lowered name is the name of the template instantiation in the generated PTX code.
char const *gemm_kernel_lowered_name;
nvrtcGetLoweredName(program, gemm_kernel_instantiation.c_str(), &gemm_kernel_lowered_name);
if (!check_nvrtc_error(result_nvrtc)) {
ASSERT_TRUE(false);
}
// Query the size of the genereated PTX so that we can allocate storage and retrieve it afterwards
size_t ptx_size;
result_nvrtc = nvrtcGetPTXSize(program, &ptx_size);
if (!check_nvrtc_error(result_nvrtc)) {
ASSERT_TRUE(false);
}
std::vector<char> ptx(ptx_size);
result_nvrtc = nvrtcGetPTX(program, ptx.data());
if (!check_nvrtc_error(result_nvrtc)) {
ASSERT_TRUE(false);
}
// we do not need the nvrtc program anymore
nvrtcDestroyProgram(&program);
CUmodule module;
CUresult result_cuda;
result_cuda = cuModuleLoadDataEx(&module, ptx.data(), 0, 0, 0);
if (result_cuda != CUDA_SUCCESS) {
ASSERT_TRUE(false);
}
CUfunction kernel;
result_cuda = cuModuleGetFunction(&kernel, module, gemm_kernel_lowered_name);
if (result_cuda != CUDA_SUCCESS) {
ASSERT_TRUE(false);
}
testbed.initialize();
if (testbed.has_cublas_support()) {
EXPECT_TRUE(testbed.verify_host_with_cublas());
}
params.initialize(testbed.M(),
testbed.N(),
testbed.K(),
testbed.alpha,
testbed.ptr_A(),
testbed.lda(),
testbed.ptr_B(),
testbed.ldb(),
testbed.beta,
testbed.ptr_C_initial(),
testbed.ldc(),
testbed.ptr_computed(),
testbed.ldc());
// Gemm::launch(params);
Gemm::launch(kernel, params);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
if (testbed.has_cublas_support()) {
ASSERT_TRUE(testbed.verify_with_cublas());
} else {
ASSERT_TRUE(testbed.verify_with_host());
}
}
@@ -0,0 +1,621 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_tests.h>
#include <tools/util/host_tensor.h>
#include <tools/util/tensor_view_io.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/shape.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <cutlass/gemm/dgemm_traits.h>
#include <cutlass/gemm/hgemm_traits.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace test {
// M/N/K struct.
struct GemmDesc {
int m, n, k;
inline __host__ __device__ GemmDesc(int m_, int n_, int k_) : m(m_), n(n_), k(k_) {}
};
/// Simple test to load from global memory and store to shared memory
// Loading from global memory and storing to shared memory for A
template <typename Traits>
__global__ void gemm_load_global_store_shared_a(
typename Traits::GlobalLoadStreamA::Scalar *output,
typename Traits::GlobalLoadStreamA::Scalar const *input,
int M,
int N,
int K,
int ldm,
int skew) {
//Create shared memory.
__shared__ typename Traits::SharedStorage shared_storage;
// Create those iterators.
typedef typename Traits::GlobalLoadStreamA GlobalLoadStreamA;
typename GlobalLoadStreamA::Params global_load_params;
GemmDesc desc(M, N, K);
global_load_params.initialize(desc, input, ldm);
GlobalLoadStreamA stream_a(global_load_params, shared_storage.main_loop.stream_a.global, M, N, K, cutlass::make_Coord(0, 0, 0));
stream_a.copy();
stream_a.commit();
// store barrier
__syncthreads();
// one thread writes everything out
if (threadIdx.x == 0) {
for (int i = 0; i < (M+skew)*K; ++i) {
output[i] = shared_storage.main_loop.stream_a.shared.scalars[i];
}
}
}
// Loading from global memory and storing to shared memory for B
template <typename Traits>
__global__ void gemm_load_global_store_shared_b(
typename Traits::GlobalLoadStreamB::Scalar *output,
typename Traits::GlobalLoadStreamB::Scalar const *input,
int M,
int N,
int K,
int ldm,
int skew) {
//Create shared memory.
__shared__ typename Traits::SharedStorage shared_storage;
// Create those iterators.
typedef typename Traits::GlobalLoadStreamB GlobalLoadStreamB;
typename GlobalLoadStreamB::Params global_load_params;
GemmDesc desc(M, N, K);
global_load_params.initialize(desc, input, ldm);
GlobalLoadStreamB stream_b(global_load_params, shared_storage.main_loop.stream_b.global, M, N, K, cutlass::make_Coord(0, 0, 0));
stream_b.copy();
stream_b.commit();
// store barrier
__syncthreads();
// one thread writes everything out
if (threadIdx.x == 0) {
for (int i = 0; i < (N+skew)*K; ++i) {
output[i] = shared_storage.main_loop.stream_b.shared.scalars[i];
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, A_float_contiguous) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
SgemmTraits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
int skew = 0;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kW, 1));
output.fill(0);
test::gemm_load_global_store_shared_a< SgemmTraits ><<<
dim3(1,1,1),
dim3(SgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
M,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, A_float_crosswise) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
SgemmTraits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
int skew = 4;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kRowMajor);
output.resize_matrix(ThreadBlockTile::kW + skew, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, ThreadBlockTile::kD, 1, 1));
output.fill(0);
test::gemm_load_global_store_shared_a< SgemmTraits ><<<
dim3(1,1,1),
dim3(SgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, B_float_contiguous) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
SgemmTraits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
int skew = 0;
input.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
output.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
input.fill_linear(cutlass::make_Coord(1, ThreadBlockTile::kH, 1, 1));
output.fill(0);
test::gemm_load_global_store_shared_b< SgemmTraits ><<<
dim3(1,1,1),
dim3(SgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
N,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, B_float_crosswise) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor, ThreadBlockTile >
SgemmTraits;
cutlass::HostTensor<float> input;
cutlass::HostTensor<float> output;
int skew = 4;
input.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kD + skew, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kD, 1));
output.fill(0);
test::gemm_load_global_store_shared_b< SgemmTraits ><<<
dim3(1,1,1),
dim3(SgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, A_double_contiguous) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
DgemmTraits;
cutlass::HostTensor<double> input;
cutlass::HostTensor<double> output;
int skew = 0;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kW, 1));
output.fill(0);
test::gemm_load_global_store_shared_a< DgemmTraits ><<<
dim3(1,1,1),
dim3(DgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
M,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, A_double_crosswise) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kRowMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
DgemmTraits;
cutlass::HostTensor<double> input;
cutlass::HostTensor<double> output;
int skew = 2;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kRowMajor);
output.resize_matrix(ThreadBlockTile::kW + skew, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, ThreadBlockTile::kD, 1, 1));
output.fill(0);
test::gemm_load_global_store_shared_a< DgemmTraits ><<<
dim3(1,1,1),
dim3(DgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, B_double_contiguous) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
DgemmTraits;
cutlass::HostTensor<double> input;
cutlass::HostTensor<double> output;
int skew = 0;
input.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
output.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
input.fill_linear(cutlass::make_Coord(1, ThreadBlockTile::kH, 1, 1));
output.fill(0);
test::gemm_load_global_store_shared_b< DgemmTraits ><<<
dim3(1,1,1),
dim3(DgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
N,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, B_double_crosswise) {
static int const M = 64;
static int const N = 64;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::DgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor, ThreadBlockTile >
DgemmTraits;
cutlass::HostTensor<double> input;
cutlass::HostTensor<double> output;
int skew = 2;
input.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kD + skew, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kD, 1));
output.fill(0);
test::gemm_load_global_store_shared_b< DgemmTraits ><<<
dim3(1,1,1),
dim3(DgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, A_half_crosswise) {
static int const M = 128;
static int const N = 128;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor, cutlass::MatrixLayout::kRowMajor, ThreadBlockTile >
HgemmTraits;
cutlass::HostTensor<cutlass::half_t> input;
cutlass::HostTensor<cutlass::half_t> output;
int skew = 8;
input.resize_matrix(ThreadBlockTile::kW, ThreadBlockTile::kD,
cutlass::MatrixLayout::kRowMajor);
output.resize_matrix(ThreadBlockTile::kW + skew, ThreadBlockTile::kD,
cutlass::MatrixLayout::kColumnMajor);
input.fill_linear(cutlass::make_Coord(1, ThreadBlockTile::kD, 1, 1));
output.fill(0);
test::gemm_load_global_store_shared_a< HgemmTraits ><<<
dim3(1,1,1),
dim3(HgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(GemmSharedMemLayout, B_half_crosswise) {
static int const M = 128;
static int const N = 128;
static int const K = 8;
typedef cutlass::Shape<K, N, M> ThreadBlockTile;
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor, ThreadBlockTile >
HgemmTraits;
cutlass::HostTensor<cutlass::half_t> input;
cutlass::HostTensor<cutlass::half_t> output;
int skew = 8;
input.resize_matrix(ThreadBlockTile::kD, ThreadBlockTile::kH,
cutlass::MatrixLayout::kColumnMajor);
output.resize_matrix(ThreadBlockTile::kD + skew, ThreadBlockTile::kH,
cutlass::MatrixLayout::kRowMajor);
input.fill_linear(cutlass::make_Coord(1, 1, ThreadBlockTile::kD, 1));
output.fill(0);
test::gemm_load_global_store_shared_b< HgemmTraits ><<<
dim3(1,1,1),
dim3(HgemmTraits::kThreads, 1)
>>>(
output.device_data(),
input.device_data(),
M,
N,
K,
K,
skew
);
cudaError_t result = cudaDeviceSynchronize();
ASSERT_EQ(result, cudaSuccess) << "\nCUDA kernel launch error: " << cudaGetErrorString(result)
<< "\n";
output.sync_host();
EXPECT_TRUE(input.bit_equals(output));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
+530
View File
@@ -0,0 +1,530 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
/*! \file
\brief Test environment for GEMM
*/
#pragma once
#include <fstream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cublas_v2.h>
#include <cutlass/matrix_traits.h>
#include <cutlass/util/platform.h>
#include <tools/util/host_tensor.h>
#include <tools/util/tensor_view_io.h>
#include <tools/util/type_traits.h>
namespace cutlass {
template <cutlass::GemmOperand::Kind kOperand_,
cutlass::MatrixLayout::Kind kLayout_,
typename Scalar_,
typename WmmaShape_>
struct WmmaMatrix;
}
namespace test {
template <typename T>
struct GemmTestbedTraits : public cutlass::TypeTraits<T> {};
template <cutlass::GemmOperand::Kind kOperand_,
cutlass::MatrixLayout::Kind kLayout_,
typename Scalar_,
typename WmmaShape_>
struct GemmTestbedTraits<cutlass::WmmaMatrix<kOperand_, kLayout_, Scalar_, WmmaShape_> > {
static cudaDataType_t const cublas_type = cutlass::TypeTraits<Scalar_>::cublas_type;
typedef Scalar_ host_type;
typedef Scalar_ device_type;
static inline double remove_negative_zero(double x) { return x == -0.0 ? 0.0 : x; }
static inline double to_print(double x) { return x; }
};
template <typename AType, typename BType, typename CType, typename Accumulator, typename Scalar>
struct GemmTestbed {
//
// Type definitions
//
/// Host tensor for operand A
typedef cutlass::HostTensor<AType> HostTensorA;
/// Host tensor for operand B
typedef cutlass::HostTensor<BType> HostTensorB;
/// Host tensor for operand C
typedef cutlass::HostTensor<CType> HostTensorC;
/// Functor to print errors
struct PrintErrors {
/// Equivalently sized integer type
typedef typename GemmTestbedTraits<CType>::integer_type integer_t;
/// Output stream to write to
std::ostream& out;
/// Reference tensor view
cutlass::HostTensorView<CType> const& reference;
/// Computed tensor view
cutlass::HostTensorView<CType> const& experimental;
/// Errors greater than or this amount result in printing
integer_t ulps_threshold;
///
PrintErrors(std::ostream& _out,
cutlass::HostTensorView<CType> const& _reference,
cutlass::HostTensorView<CType> const& _experimental,
integer_t _ulps_threshold = 1)
: out(_out),
reference(_reference),
experimental(_experimental),
ulps_threshold(_ulps_threshold) {}
/// Compares one element
void operator()(CType const& element, typename HostTensorC::Coord_t coord) {
CType exp = experimental.at(coord);
CType ref = reference.at(coord);
int64_t int_exp = 0;
int64_t int_ref = 0;
*reinterpret_cast<CType*>(&int_exp) = exp;
*reinterpret_cast<CType*>(&int_ref) = ref;
integer_t ulps = integer_t(int_exp - int_ref);
if (std::abs(ulps) >= ulps_threshold) {
// width in hexadecimal digits of value
int const width = sizeof(integer_t) * 2;
double relative = double(exp) - double(ref);
if (ref != CType(0)) {
relative /= double(ref);
}
out << "[" << coord << "] expected: " << GemmTestbedTraits<CType>::to_print(ref) << " (0x"
<< std::hex << std::setw(width) << std::setfill('0') << integer_t(int_ref) << std::dec
<< ")"
<< ", got: " << GemmTestbedTraits<CType>::to_print(exp) << " (0x" << std::hex
<< std::setw(width) << std::setfill('0') << integer_t(int_exp) << std::dec << ")"
<< " relative error: " << relative << ", ulps: " << ulps << "\n";
}
}
};
/// Generates random elements
template <typename T>
struct RandomGenerator {
RandomGenerator(int seed = -1, bool only_ones_ = false) : only_ones(only_ones_) { srand(seed); }
T operator()() {
if (only_ones) {
return T(1);
} else {
int val = (rand() % 16) - 8;
return T(val);
}
}
bool only_ones;
};
//
// Data members
//
/// Status
cublasStatus_t status;
/// cuBLAS handle
cublasHandle_t handle;
/// cuBLAS GEMM algorithm selector
cublasGemmAlgo_t algorithm;
/// A matrix operand
HostTensorA A;
/// Layout of A matrix
cublasOperation_t layout_A;
/// B matrix operand
HostTensorB B;
/// Layout of B matrix
cublasOperation_t layout_B;
/// C matrix operand
HostTensorC C_initial;
/// Reference result computed on the host
cutlass::HostTensor<CType, false> ref_host;
/// Reference result computed with cublas
HostTensorC ref_cublas;
/// Computed result
HostTensorC computed;
/// Linear scalaring factor
Scalar alpha;
/// Linear scaling factor
Scalar beta;
//
// Static helpers
//
/// Helper to resize a matrix with a given size and layout
template <typename T, bool DeviceBacked>
static void resize(cutlass::HostTensor<T, DeviceBacked>& tensor,
int rows,
int columns,
cublasOperation_t layout,
int ldm = 0) {
if (!ldm) {
ldm = (layout == CUBLAS_OP_N ? rows : columns);
}
typedef cutlass::Coord<cutlass::HostTensor<T>::Rank> Coord_t;
Coord_t stride = cutlass::make_Coord(
rows * columns, layout == CUBLAS_OP_N ? 1 : ldm, layout == CUBLAS_OP_N ? ldm : 1, 1);
Coord_t size = cutlass::make_Coord(1, rows, columns, 1);
tensor.reset(stride, size);
}
//
// Methods
//
/// Constructs a workspace for verifying GEMM, assumes
/// dense packing.
GemmTestbed(int M_,
int N_,
int K_,
cublasOperation_t layout_a,
cublasOperation_t layout_b,
Scalar alpha_ = Scalar(1),
Scalar beta_ = Scalar(0),
cublasGemmAlgo_t algorithm_ = CUBLAS_GEMM_DEFAULT,
cublasOperation_t layout_c = CUBLAS_OP_N)
: layout_A(layout_a), layout_B(layout_b), alpha(alpha_), beta(beta_), algorithm(algorithm_) {
status = cublasCreate(&handle);
if (status != CUBLAS_STATUS_SUCCESS) {
throw cutlass::cuda_exception("Failed to create CUBLAS handle");
}
resize(A, M_, K_, layout_a);
resize(B, K_, N_, layout_b);
resize(C_initial, M_, N_, layout_c);
resize(ref_host, M_, N_, layout_c);
resize(ref_cublas, M_, N_, layout_c);
resize(computed, M_, N_, layout_c);
}
/// Constructs a workspace for verifying GEMM with arbitrary strides
GemmTestbed(int M_,
int N_,
int K_,
int ldc,
cublasOperation_t layout_a,
int lda,
cublasOperation_t layout_b,
int ldb,
Scalar alpha_ = Scalar(1),
Scalar beta_ = Scalar(0),
cublasGemmAlgo_t algorithm_ = CUBLAS_GEMM_DEFAULT,
cublasOperation_t layout_c = CUBLAS_OP_N)
: alpha(alpha_), beta(beta_), algorithm(algorithm_) {
status = cublasCreate(&handle);
if (status != CUBLAS_STATUS_SUCCESS) {
throw cutlass::cuda_exception("Failed to create CUBLAS handle");
}
resize(A, M_, K_, layout_a, lda);
resize(B, K_, N_, layout_b, ldb);
resize(C_initial, M_, N_, layout_c, ldc);
resize(ref_host, M_, N_, layout_c, ldc);
resize(ref_cublas, M_, N_, layout_c, ldc);
resize(computed, M_, N_, layout_c, ldc);
}
~GemmTestbed() { status = cublasDestroy(handle); }
/// Returns true if the last CUBLAS call returned successfully
bool good() const { return status == CUBLAS_STATUS_SUCCESS; }
/// Returns a pointer to the A operand
typename HostTensorA::DeviceType* ptr_A() const { return A.device_data(); }
/// Stride of A matrix
int lda() const { return std::max(A.stride(HostTensorA::Dim_H), A.stride(HostTensorA::Dim_W)); }
/// Returns a pointer to the B operand
typename HostTensorB::DeviceType* ptr_B() const { return B.device_data(); }
/// Stride of B matrix
int ldb() const { return std::max(B.stride(HostTensorB::Dim_H), B.stride(HostTensorB::Dim_W)); }
/// Returns a pointer to the initial state of the result tensor in device memory
typename HostTensorC::DeviceType* ptr_C_initial() const { return C_initial.device_data(); }
/// Returns a pointer to the result tensor in device memory
typename HostTensorC::DeviceType* ptr_computed() const { return computed.device_data(); }
/// Returns a pointer to the result tensor in device memory
typename HostTensorC::DeviceType* ptr_cublas() const { return ref_cublas.device_data(); }
/// Stride of C matrix
int ldc() const {
return std::max(C_initial.stride(HostTensorC::Dim_H), C_initial.stride(HostTensorC::Dim_W));
}
/// Returns the number of flops implied by the computation (1 multiply-accumulate = 2 flops)
uint64_t flops() const { return uint64_t(M()) * uint64_t(N()) * uint64_t(K()) * 2ULL; }
/// Computes the speed of the computation in GFLOPs/s
double GFLOPs_per_sec(double runtime_ms) const { return double(flops()) / runtime_ms / 1.0e6; }
/// Matrix layout of A
cublasOperation_t layout_a() const { return layout_A; }
/// Matrix layout of B
cublasOperation_t layout_b() const { return layout_B; }
/// Number of rows of problem
int M() const { return C_initial.size(HostTensorC::Dim_H); }
/// Number of columns of problem
int N() const { return C_initial.size(HostTensorC::Dim_W); }
/// Number of columns of problem
int K() const { return A.size(HostTensorA::Dim_W); }
/// Initializes data, randomly
void initialize(int seed = -1) {
A.fill_random(RandomGenerator<AType>(seed));
B.fill_random(RandomGenerator<BType>(seed + 11));
C_initial.fill_random(RandomGenerator<CType>(seed + 13));
}
/// Computes the matrix product on the host
void compute_host() {
ref_host.fill(C_initial);
ref_host.template gemm<AType, BType, Accumulator, Scalar>(A, B, alpha, beta);
}
/// Excutes an equivalent GEMM using cuBLAS
bool execute_cublas() {
status = cublasGemmEx(handle,
layout_a(),
layout_b(),
M(),
N(),
K(),
&alpha,
ptr_A(),
cutlass::TypeTraits<AType>::cublas_type,
lda(),
ptr_B(),
cutlass::TypeTraits<BType>::cublas_type,
ldb(),
&beta,
ref_cublas.device_data(),
cutlass::TypeTraits<CType>::cublas_type,
ldc(),
cutlass::TypeTraits<Accumulator>::cublas_type,
algorithm);
return status == CUBLAS_STATUS_SUCCESS;
}
/// Computes the matrix product using cuBLAS
void compute_cublas() {
ref_cublas.fill(C_initial);
if (!execute_cublas()) {
throw std::runtime_error("compute_cublas() failed");
}
}
//
// Compute the GEMM yourself
//
/// Names a probelm based on data type and problem size
std::string workspace_name() const {
std::stringstream ss;
ss << "gemm_" << (layout_a() == CUBLAS_OP_N ? "n" : "t")
<< (layout_b() == CUBLAS_OP_N ? "n" : "t") << "_" << typeid(AType).name() << "_"
<< typeid(BType).name() << "_" << typeid(CType).name() << "_" << typeid(Accumulator).name()
<< "_" << typeid(Scalar).name() << "_" << M() << "x" << N() << "x" << K();
return ss.str();
}
/// Writes the workspace to an ostream
std::ostream& write(std::ostream& out) const {
out << "A = " << A << "\nB = " << B << "\nC_initial = " << C_initial
<< "\nref_host = " << ref_host << "\nref_cublas = " << ref_cublas
<< "\ncomputed = " << computed << std::endl;
return out;
}
/// Outputs each mismatching element
std::ostream& write_errors(std::ostream& out,
cutlass::HostTensorView<CType> const& experimental,
cutlass::HostTensorView<CType> const& ref) const {
PrintErrors printer(out, ref, experimental);
computed.visit(printer);
return out;
}
/// Sync's all input tensors to device
void sync_device() {
A.sync_device();
B.sync_device();
C_initial.sync_device();
ref_host.fill(C_initial);
ref_cublas.fill(C_initial);
computed.fill(C_initial);
ref_cublas.sync_device();
computed.sync_device();
}
/// Sync's all output tensors to host
void sync_host() {
computed.sync_host();
ref_cublas.sync_host();
}
/// Saves the workspace to files
void save_workspace(cutlass::HostTensorView<CType> const& experimental,
cutlass::HostTensorView<CType> const& ref) {
std::string name = workspace_name();
std::string results_name = name + "_results.txt";
std::string errors_name = name + "_errors.txt";
std::ofstream results(results_name.c_str());
std::ofstream errors(errors_name.c_str());
write(results);
write_errors(errors, experimental, ref);
}
/// Verifies the contents of C equal the host-side reference
bool verify_with_host(bool save_on_error = true, bool always_print = false) {
compute_host();
computed.sync_host();
bool passed = computed.bit_equals(ref_host);
if ((!passed && save_on_error) || always_print) {
save_workspace(computed, ref_host);
}
return passed;
}
/// Verifies the contents of computed equal cuBLAS
bool verify_with_cublas(bool save_on_error = true, bool always_print = false) {
compute_cublas();
ref_cublas.sync_host();
computed.sync_host();
bool passed = computed.bit_equals(ref_cublas);
if ((!passed && save_on_error) || always_print) {
save_workspace(computed, ref_cublas);
}
return passed;
}
/// Verifies the host computation with cuBLAS
bool verify_host_with_cublas(bool save_on_error = true, bool always_print = false) {
compute_host();
compute_cublas();
ref_cublas.sync_host();
bool passed = ref_host.bit_equals(ref_cublas);
if ((!passed && save_on_error) || always_print) {
save_workspace(ref_host, ref_cublas);
}
return passed;
}
/// Verifies with host-side and device-side computations
bool verify_with_all() {
bool passed = true;
computed.sync_host();
// verify on host
passed = (passed && verify_with_host());
// verify with cublas
passed = (passed && verify_with_cublas());
return passed;
}
bool has_cublas_support() const { return cutlass::platform::is_same<Accumulator, Scalar>::value; }
};
} // namespace test
namespace cutlass {
inline cublasOperation_t convert(cutlass::MatrixLayout::Kind layout) {
switch (layout) {
case cutlass::MatrixLayout::kRowMajor:
return CUBLAS_OP_T;
case cutlass::MatrixLayout::kColumnMajor:
return CUBLAS_OP_N;
default:
break;
}
return CUBLAS_OP_N;
}
}
+388
View File
@@ -0,0 +1,388 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <tools/util/half.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/hgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x8_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x9_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x64_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x128x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x256x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x256x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x2_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 2);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x8_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x10_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x64_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x128x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x256x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x256x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x8_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x10_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x64_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x128x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x256x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x256x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x8_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x10_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x64_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x128x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x256x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_256x256x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_alpha2_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16, cutlass::half_t(2), cutlass::half_t(0));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_beta1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16, cutlass::half_t(1), cutlass::half_t(1));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_128x128x16_alpha2_beta1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16, cutlass::half_t(2), cutlass::half_t(1));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_120x112x64_ldg8_nt) {
// Load 8 halfs per LDG for A/B.
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128>,
cutlass::gemm::LinearScaling<half>,
cutlass::Shape<8, 8, 16>,
8, 8>
HgemmTraits;
run_gemm<HgemmTraits>(120, 112, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_508x252x120_ragged_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(508, 252, 120);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_124x126x32_ragged_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(124, 126, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x128x8, hgemm_124x126x32_ragged_alpha2_beta1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(124, 126, 32, cutlass::half_t(2), cutlass::half_t(1));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+314
View File
@@ -0,0 +1,314 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/hgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x8_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x9_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x32_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x32x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x64x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x64x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x2_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 2);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x8_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x10_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x32_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x32x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x64x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x64x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x8_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x10_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x32_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x32x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x64x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x64x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x8_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x10_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x32x32_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x32x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_128x64x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x32x8, hgemm_256x64x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+314
View File
@@ -0,0 +1,314 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/hgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x1_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x8_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x9_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x64_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x64x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x128x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x128x16_nt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x2_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 2);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x8_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x10_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x64_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x64x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x128x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x128x16_nn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x8_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x10_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x64_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x64x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x128x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x128x16_tn) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x8_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x10_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 10);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x64x64_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x64x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_128x128x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Hgemm_128x64x8, hgemm_256x128x16_tt) {
typedef cutlass::gemm::HgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
HgemmTraits;
run_gemm<HgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+351
View File
@@ -0,0 +1,351 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/igemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x4_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x36_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x256_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x4_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x36_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x256_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x4_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x36_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x256_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x4_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x36_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x128x256_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_128x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32, igemm_256x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int, cutlass::gemm::LinearScaling<int> >
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,352 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/igemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x4_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x36_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x256_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x4_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x36_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x256_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x4_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x36_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x256_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x4_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x36_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x128x256_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_128x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_float, igemm_256x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, float>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,351 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/igemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x4_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x36_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x256_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x256x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x4_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x36_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x256_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x256x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x4_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x36_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x256_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x256x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x4_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> , int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x36_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x128x256_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_128x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(128, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x128x32_int8, igemm_256x256x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>, int8_t>
IgemmTraits;
run_gemm<IgemmTraits>(256, 256, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+351
View File
@@ -0,0 +1,351 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/igemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x32x4_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 20);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x36_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x256_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x32x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x128x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x128x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x4_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x36_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x256_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x32x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x128x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x128x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x4_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x36_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x256_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x32x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x128x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x128x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x4_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 32, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x36_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x32x256_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 32, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x32x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_128x128x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x32x32, igemm_256x128x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 32, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+351
View File
@@ -0,0 +1,351 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/igemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, Igemm_128x64x4_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x32_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x36_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x256_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x64x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x128x64_nt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x4_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x32_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x36_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x256_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x64x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x128x64_nn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x4_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x32_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x36_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x256_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x64x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x128x64_tn) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x4_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 64, 128> , int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 4);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x32_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x36_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 36);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x64x256_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 64, 256);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x64x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_128x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(128, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Igemm_128x64x32, igemm_256x128x64_tt) {
typedef cutlass::gemm::IgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 64, 128>, int>
IgemmTraits;
run_gemm<IgemmTraits>(256, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+373
View File
@@ -0,0 +1,373 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x81x1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 81, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x8_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x9_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x73x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 73, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_97x112x64_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(97, 112, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x112x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x240x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 240, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x240x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 240, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x1_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_79x112x8_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(79, 112, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x81x9_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 81, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x73x64_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 73, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x112x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x256x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x256x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x128x1_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_127x112x8_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(127, 112, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_21x112x9_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(21, 112, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x73x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 73, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x81x64_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 81, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x112x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_47x256x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(47, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_211x256x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(211, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x128x1_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_109x112x8_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(109, 112, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x9_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_123x112x64_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(123, 112, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x112x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 112, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x256x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_256x256x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 256, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_120x112x64_ldg4_nt) {
// Load 4 floats per LDG for A/B.
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 128>,
cutlass::gemm::LinearScaling<float>,
cutlass::Shape<8, 8, 8>,
4, 4>
SgemmTraits;
run_gemm<SgemmTraits>(120, 112, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x128x16_alpha2_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16, 2.f, 0.f);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x16_beta1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 16, 1.f, 1.f);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x128x8, sgemm_128x112x16_alpha2_beta1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 112, 16, 2.f, 1.f);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+332
View File
@@ -0,0 +1,332 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x8_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x9_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x32_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x32x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x1_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x8_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x9_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x32_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x32x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x1_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x8_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x9_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x32_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x32x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x1_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x8_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x9_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x32x32_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x32x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_128x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x32x8, sgemm_256x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+356
View File
@@ -0,0 +1,356 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x8_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x9_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x128x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x128x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x1_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x8_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x9_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x128x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x128x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x1_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x8_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x9_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x128x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x128x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x1_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 128, 128> > SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x8_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x9_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x128x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_256x128x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 128> >
SgemmTraits;
run_gemm<SgemmTraits>(256, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_8x4_accumulators_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 128>,
cutlass::gemm::LinearScaling<float>,
cutlass::Shape<8, 4, 8> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_128x64x8, sgemm_128x64x64_4x8_accumulators_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 64, 128>,
cutlass::gemm::LinearScaling<float>,
cutlass::Shape<8, 8, 4> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+43
View File
@@ -0,0 +1,43 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x128x8, sgemm_64x128x64_4x8_accumulators_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<8, 128, 64>,
cutlass::gemm::LinearScaling<float>,
cutlass::Shape<8, 8, 4> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 128, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+324
View File
@@ -0,0 +1,324 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x8_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x9_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x64_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x32x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x1_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x8_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x9_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x64_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x32x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x8_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x9_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x64_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x32x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x64x1_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> > SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x8_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x9_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x32x64_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 32, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x32x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 32, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_64x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x32x8, sgemm_128x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 32, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+332
View File
@@ -0,0 +1,332 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/sgemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x1_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x8_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x9_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x64_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x64x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x128x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x128x16_nt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x1_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x8_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x9_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x64_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x64x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x128x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x128x16_nn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x1_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor, cutlass::Shape<8, 64, 64> > SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x8_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x9_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x64_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x64x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x128x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x128x16_tn) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x1_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> > SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x8_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 8);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x9_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 9);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x64x64_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 64, 64);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x64x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 64, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_64x128x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(64, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(Sgemm_64x64x8, sgemm_128x128x16_tt) {
typedef cutlass::gemm::SgemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor, cutlass::Shape<8, 64, 64> >
SgemmTraits;
run_gemm<SgemmTraits>(128, 128, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+280
View File
@@ -0,0 +1,280 @@
/***************************************************************************************************
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* 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 NVIDIA CORPORATION 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 TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
#include <cutlass/wmma_matrix.h>
#if defined(CUTLASS_USE_WMMA_API)
#include <cutlass_unit_test.h>
#include <cutlass/gemm/gemm.h>
#include <cutlass/gemm/wmma_gemm_traits.h>
#include <tools/test/unit/gemm/gemm_testbed.h>
#include <tools/test/unit/gemm/gemm.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x16_nt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x32_nt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_16x16x16_gemm_256x256x128_nt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_8x32x16_gemm_256x256x128_nt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 32, 8> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_32x8x16_gemm_256x256x128_nt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 8, 32> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x16_nn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x32_nn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_16x16x16_gemm_256x256x128_nn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_8x32x16_gemm_256x256x128_nn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 32, 8> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_32x8x16_gemm_256x256x128_nn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kColumnMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 8, 32> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x16_tt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x32_tt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_16x16x16_gemm_256x256x128_tt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_8x32x16_gemm_256x256x128_tt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 32, 8> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_32x8x16_gemm_256x256x128_tt) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kRowMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 8, 32> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x16_tn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 16);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_16x16x32, wmma_gemm_16x16x32_tn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 16, 16> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(16, 16, 32);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_16x16x16_gemm_256x256x128_tn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_8x32x16_gemm_256x256x128_tn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 32, 8> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST(WmmaGemm_128x128x32, wmma_32x8x16_gemm_256x256x128_tn) {
typedef cutlass::gemm::WmmaGemmTraits<cutlass::MatrixLayout::kRowMajor,
cutlass::MatrixLayout::kColumnMajor,
cutlass::Shape<32, 128, 128>,
float,
cutlass::gemm::LinearScaling<float>,
float,
cutlass::Shape<32, 64, 64>,
cutlass::Shape<16, 8, 32> >
WmmaGemmTraits;
run_gemm<WmmaGemmTraits>(256, 256, 128);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
#endif // defined CUTLASS_USE_WMMA_API
+66
View File
@@ -0,0 +1,66 @@
/******************************************************************************
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are not permitted.
*
* 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 NVIDIA CORPORATION 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.
*
******************************************************************************/
/*! \file
\brief Tests for Host_tensor, Host_tensor_view, and Tensor_view
*/
//#include <gtest/gtest.h>
#include <cutlass_unit_test.h>
#include <tools/util/host_tensor.h>
#include <tools/util/tensor_view_io.h>
/// Random number generator
struct RandomGenerator {
RandomGenerator(int seed = 17) {
srand(seed);
}
float operator()() {
return float(rand() % 64) / 8.0f;
}
};
TEST(HostTensor, gemm) {
int const M = 16;
int const N = 16;
int const K = 16;
typedef cutlass::HostTensor<float, false> HostTensor;
// allocate a host tensor
HostTensor A(
cutlass::make_Coord(1, K, M, 1)
);
HostTensor B(
cutlass::make_Coord(1, N, K, 1)
);
HostTensor C(
cutlass::make_Coord(1, N, M, 1)
);
A.fill_random(RandomGenerator());
B.fill_random(RandomGenerator());
C.gemm<float, float, float, float>(A, B, 1.0f, 0.0f);
}