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

Function arg_as_scalar

tools/profiler/src/problem_space.cpp:1165–1190  ·  view source on GitHub ↗

Lexically casts an argument to a given type stored in a byte array. Returns true if not null.

Source from the content-addressed store, hash-verified

1163
1164/// Lexically casts an argument to a given type stored in a byte array. Returns true if not null.
1165bool arg_as_scalar(
1166 std::vector<uint8_t> &bytes,
1167 library::NumericTypeID numeric_type,
1168 KernelArgument::Value const *value_ptr) {
1169
1170 if (value_ptr->not_null) {
1171 if (value_ptr->argument->description->type == ArgumentTypeID::kInteger) {
1172 int64_t int_value = static_cast<IntegerArgument::IntegerValue const *>(value_ptr)->value;
1173
1174 // TODO - convert int64_t => destination type
1175 }
1176 else if (value_ptr->argument->description->type == ArgumentTypeID::kScalar) {
1177 std::string const &str_value = static_cast<ScalarArgument::ScalarValue const *>(value_ptr)->value;
1178
1179 return lexical_cast(bytes, numeric_type, str_value);
1180 }
1181 else {
1182 throw std::runtime_error(
1183 "arg_as_int() - illegal cast. Problem space argument must be integer or scalar");
1184 }
1185
1186 return true;
1187 }
1188
1189 return false;
1190}
1191
1192/// Lexically casts an argument to a given type and returns a byte array
1193bool arg_as_scalar(

Callers

nothing calls this directly

Calls 4

lexical_castFunction · 0.85
argument_indexMethod · 0.80
getMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected