File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
src/meta_schedule/schedule_rule Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -87,15 +87,18 @@ void MultiLevelTilingNode::InitializeWithTuneContext(const TuneContext& context)
8787 TVM_PY_LOG (INFO, context->logger ) << " 'thread_warp_size' is not defined in the target" ;
8888 }
8989 }
90- Optional<String> arch_attr = context->target .value ()->GetAttr <String>(" arch" );
91- if (arch_attr.defined ()) {
92- String arch = arch_attr.value ();
93- // format: sm_xx
94- // @see src/target/tag.cc
95- if (arch.size () == 5 && (strncmp (arch.c_str (), " sm_" , 3 ) == 0 )) {
96- // only sm_80 or higher supports async memcopy
97- if (arch.at (3 ) >= ' 8' ) {
98- this ->stages .insert (this ->stages .end (), {4 , 5 });
90+ if (Optional<String> opt_sm = context->target .value ()->GetAttr <String>(" arch" )) {
91+ std::string sm = opt_sm.value ();
92+ if (support::StartsWith (sm, " sm_" )) {
93+ sm = sm.substr (3 );
94+ try {
95+ // only sm_80 or higher supports async memcopy
96+ if (std::stoi (sm) >= 80 ) {
97+ this ->stages .insert (this ->stages .end (), {4 , 5 });
98+ }
99+ } catch (const std::invalid_argument& e) {
100+ LOG (WARNING) << " ValueError: Unable to parse `target.arch`: " << sm
101+ << " . Details: " << e.what ();
99102 }
100103 }
101104 }
You can’t perform that action at this time.
0 commit comments