MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / arg_as_int

Function arg_as_int

tools/profiler/src/problem_space.cpp:743–762  ·  view source on GitHub ↗

Lexically casts an argument to an int64 if it is defined. Returns true if not null.

Source from the content-addressed store, hash-verified

741
742/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
743bool arg_as_int(int64_t &int_value, KernelArgument::Value const *value_ptr) {
744 if (value_ptr->not_null) {
745 if (value_ptr->argument->description->type == ArgumentTypeID::kInteger) {
746 int_value = static_cast<IntegerArgument::IntegerValue const *>(value_ptr)->value;
747 }
748 else if (value_ptr->argument->description->type == ArgumentTypeID::kScalar) {
749 std::stringstream ss;
750 ss << static_cast<ScalarArgument::ScalarValue const *>(value_ptr)->value;
751 ss >> int_value;
752 }
753 else {
754 throw std::runtime_error(
755 "arg_as_int64_t() - illegal cast. Problem space argument must be integer or scalar");
756 }
757
758 return true;
759 }
760
761 return false;
762}
763
764/// Lexically casts an argument to an int64 if it is defined. Returns true if not null.
765bool arg_as_int(int &int_value, KernelArgument::Value const *value_ptr) {

Callers 1

arg_as_boolFunction · 0.85

Calls 3

argument_indexMethod · 0.80
getMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected