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

Function arg_as_bool

tools/profiler/src/problem_space.cpp:804–824  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

802
803/// Lexically casts an argument to an bool if it is defined. Returns true if not null.
804bool arg_as_bool(bool &bool_value, KernelArgument::Value const *value_ptr) {
805 if (value_ptr->not_null) {
806 if (value_ptr->argument->description->type == ArgumentTypeID::kInteger) {
807 int64_t value64;
808 arg_as_int(value64, value_ptr);
809 bool_value = static_cast<bool>(value64);
810 }
811 else if (value_ptr->argument->description->type == ArgumentTypeID::kEnumerated) {
812 bool_value = library::from_string<bool>(
813 static_cast<EnumeratedTypeArgument::EnumeratedTypeValue const *>(value_ptr)->element);
814 }
815 else {
816 throw std::runtime_error(
817 "arg_as_bool() - illegal cast. Problem space argument must be integer or enumerated");
818 }
819
820 return true;
821 }
822
823 return false;
824}
825
826/// Lexically casts an argument to a bool
827bool arg_as_bool(

Callers

nothing calls this directly

Calls 4

arg_as_intFunction · 0.85
argument_indexMethod · 0.80
getMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected