CUTLASS 2.4 (Implicit GEMM convolution) (#147)
CUTLASS 2.4 (Implicit GEMM Convolution) Co-authored-by: Manish Gupta <manigupta@nvidia.com>, Haicheng Wu <haichengw@nvidia.com>, Dustyn Blasig <dblasig@nvidia.com>, Andrew Kerr <akerr@nvidia.com>
This commit is contained in:
@@ -961,6 +961,85 @@ bool arg_as_SplitKModeID(
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
|
||||
bool arg_as_ConvModeID(
|
||||
library::ConvModeID &conv_mode,
|
||||
KernelArgument::Value const *value_ptr) {
|
||||
|
||||
if (value_ptr->not_null) {
|
||||
if (value_ptr->argument->description->type == ArgumentTypeID::kEnumerated) {
|
||||
|
||||
conv_mode = library::from_string<library::ConvModeID>(
|
||||
static_cast<EnumeratedTypeArgument::EnumeratedTypeValue const *>(value_ptr)->element);
|
||||
|
||||
if (conv_mode == library::ConvModeID::kInvalid) {
|
||||
throw std::runtime_error(
|
||||
"arg_as_ConvModeID() - illegal cast.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
throw std::runtime_error(
|
||||
"arg_as_ConvModeID() - illegal cast.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
|
||||
bool arg_as_ConvModeID(
|
||||
library::ConvModeID &conv_mode,
|
||||
char const *name,
|
||||
ProblemSpace const &problem_space,
|
||||
ProblemSpace::Problem const &problem) {
|
||||
|
||||
size_t idx = problem_space.argument_index(name);
|
||||
KernelArgument::Value const *value_ptr = problem.at(idx).get();
|
||||
|
||||
return arg_as_ConvModeID(conv_mode, value_ptr);
|
||||
}
|
||||
|
||||
/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
|
||||
bool arg_as_ProviderID(
|
||||
library::Provider &provider,
|
||||
KernelArgument::Value const *value_ptr) {
|
||||
|
||||
if (value_ptr->not_null) {
|
||||
if (value_ptr->argument->description->type == ArgumentTypeID::kEnumerated) {
|
||||
|
||||
provider = library::from_string<library::Provider>(
|
||||
static_cast<EnumeratedTypeArgument::EnumeratedTypeValue const *>(value_ptr)->element);
|
||||
|
||||
if (provider == library::Provider::kInvalid) {
|
||||
throw std::runtime_error(
|
||||
"arg_as_ProviderID() - illegal cast.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
throw std::runtime_error(
|
||||
"arg_as_ProviderID() - illegal cast.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
|
||||
bool arg_as_ProviderID(
|
||||
library::Provider &provider,
|
||||
char const *name,
|
||||
ProblemSpace const &problem_space,
|
||||
ProblemSpace::Problem const &problem) {
|
||||
|
||||
size_t idx = problem_space.argument_index(name);
|
||||
KernelArgument::Value const *value_ptr = problem.at(idx).get();
|
||||
|
||||
return arg_as_ProviderID(provider, value_ptr);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Lexically casts an argument to a given type stored in a byte array. Returns true if not null.
|
||||
bool arg_as_scalar(
|
||||
std::vector<uint8_t> &bytes,
|
||||
@@ -1049,9 +1128,94 @@ bool tensor_description_satisfies(
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Returns true if conv_kind satisfies the value
|
||||
bool conv_kind_satisfies(
|
||||
library::ConvKind const &conv_kind,
|
||||
EnumeratedTypeArgument::EnumeratedTypeValue const *value_ptr) {
|
||||
|
||||
if (value_ptr->not_null) {
|
||||
library::ConvKind conv_kind_cmd_line =
|
||||
library::from_string<library::ConvKind>(value_ptr->element);
|
||||
|
||||
if (conv_kind_cmd_line != library::ConvKind::kUnknown &&
|
||||
conv_kind_cmd_line != conv_kind) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns true if conv_kind satisfies the value
|
||||
bool conv_kind_satisfies(
|
||||
library::ConvKind const &conv_kind,
|
||||
char const *name,
|
||||
ProblemSpace const &problem_space,
|
||||
ProblemSpace::Problem const &problem) {
|
||||
|
||||
size_t idx = problem_space.argument_index(name);
|
||||
KernelArgument::Value const *value_ptr = problem.at(idx).get();
|
||||
|
||||
if (value_ptr->argument->description->type == ArgumentTypeID::kEnumerated) {
|
||||
return conv_kind_satisfies(
|
||||
conv_kind,
|
||||
static_cast<EnumeratedTypeArgument::EnumeratedTypeValue const *>(value_ptr));
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Kernel argument mismatch");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Returns true if a iterator algorithm satisfies the value
|
||||
bool iterator_algorithm_satisfies(
|
||||
library::IteratorAlgorithmID const &iterator_algorithm,
|
||||
EnumeratedTypeArgument::EnumeratedTypeValue const *value_ptr) {
|
||||
|
||||
if (value_ptr->not_null) {
|
||||
library::IteratorAlgorithmID iterator_algorithm_cmd_line =
|
||||
library::from_string<library::IteratorAlgorithmID>(value_ptr->element);
|
||||
|
||||
if (iterator_algorithm_cmd_line != library::IteratorAlgorithmID::kNone &&
|
||||
iterator_algorithm_cmd_line != iterator_algorithm) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns true if a iterator algorithm satisfies the value
|
||||
bool iterator_algorithm_satisfies(
|
||||
library::IteratorAlgorithmID const &iterator_algorithm,
|
||||
char const *name,
|
||||
ProblemSpace const &problem_space,
|
||||
ProblemSpace::Problem const &problem) {
|
||||
|
||||
size_t idx = problem_space.argument_index(name);
|
||||
KernelArgument::Value const *value_ptr = problem.at(idx).get();
|
||||
|
||||
if (value_ptr->argument->description->type == ArgumentTypeID::kEnumerated) {
|
||||
return iterator_algorithm_satisfies(
|
||||
iterator_algorithm,
|
||||
static_cast<EnumeratedTypeArgument::EnumeratedTypeValue const *>(value_ptr));
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Kernel argument mismatch");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace profiler
|
||||
} // namespace cutlass
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user