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

Function arg_as_string

tools/profiler/src/problem_space.cpp:1208–1232  ·  view source on GitHub ↗

Returns a copy of the string passed to the argument. (kScalar arguments are stored as strings).

Source from the content-addressed store, hash-verified

1206/// Returns a copy of the string passed to the argument.
1207/// (kScalar arguments are stored as strings).
1208bool arg_as_string(
1209 std::string& arg,
1210 char const* name,
1211 ProblemSpace const& problem_space,
1212 ProblemSpace::Problem const& problem) {
1213
1214 size_t idx = problem_space.argument_index(name);
1215 KernelArgument::Value const* value_ptr = problem.at(idx).get();
1216
1217 if (value_ptr->not_null) {
1218 if (value_ptr->argument->description->type == ArgumentTypeID::kScalar) {
1219 std::string const& str_value =
1220 static_cast<ScalarArgument::ScalarValue const*>(value_ptr)->value;
1221 arg = std::string(str_value);
1222 }
1223 else {
1224 throw std::runtime_error(
1225 "arg_as_string() - illegal cast. Problem space argument must be scalar");
1226 }
1227
1228 return true;
1229 }
1230
1231 return false;
1232}
1233
1234/////////////////////////////////////////////////////////////////////////////////////////////////
1235

Callers

nothing calls this directly

Calls 3

argument_indexMethod · 0.80
getMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected