-
Notifications
You must be signed in to change notification settings - Fork 4k
[MetaSchedule][ARM] Enable ARM CPU intrinsic for MetaSchedule #14209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,94 @@ Array<ScheduleRule> ScheduleRule::DefaultMicro() { | |
| }; | ||
| } | ||
|
|
||
| Array<ScheduleRule> GetNeonSpecificRules() { | ||
| return { | ||
| ScheduleRule::MultiLevelTilingWithIntrin( | ||
| /*intrin_name=*/String("dot_4x4_i8i8s32_neon"), | ||
| /*structure=*/"SSRSRS", | ||
| /*tile_binds=*/NullOpt, | ||
| /*max_innermost_factor=*/Integer(32), | ||
| /*vector_load_lens=*/NullOpt, | ||
| /*reuse_read=*/NullOpt, | ||
| /*reuse_write=*/ | ||
| Map<String, ObjectRef>{{"req", String("may")}, | ||
| {"levels", Array<Integer>{1, 2}}, | ||
| {"scope", String("global")}}), | ||
| }; | ||
| } | ||
|
|
||
| Array<ScheduleRule> GetDotprodSpecificRules() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is specific to "ARM" dot product only so the naming is not the best. I'll merge it for now, but please fix this when you get a chance later. |
||
| return { | ||
| ScheduleRule::MultiLevelTilingWithIntrin( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand, new API in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is not in use rn. |
||
| /*intrin_name=*/String("dot_4x4_i8i8s32_sdot"), | ||
| /*structure=*/"SSRSRS", | ||
| /*tile_binds=*/NullOpt, | ||
| /*max_innermost_factor=*/Integer(32), | ||
| /*vector_load_lens=*/NullOpt, | ||
| /*reuse_read=*/NullOpt, | ||
| /*reuse_write=*/ | ||
| Map<String, ObjectRef>{{"req", String("may")}, | ||
| {"levels", Array<Integer>{1, 2}}, | ||
| {"scope", String("global")}}), | ||
| ScheduleRule::MultiLevelTilingWithIntrin( | ||
| /*intrin_name=*/String("dot_4x4_u8u8u32_udot"), | ||
| /*structure=*/"SSRSRS", | ||
| /*tile_binds=*/NullOpt, | ||
| /*max_innermost_factor=*/Integer(32), | ||
| /*vector_load_lens=*/NullOpt, | ||
| /*reuse_read=*/NullOpt, | ||
| /*reuse_write=*/ | ||
| Map<String, ObjectRef>{{"req", String("may")}, | ||
| {"levels", Array<Integer>{1, 2}}, | ||
| {"scope", String("global")}}), | ||
| ScheduleRule::MultiLevelTilingWithIntrin( | ||
| /*intrin_name=*/String("dot_4x4_u8u8i32_hdot"), | ||
| /*structure=*/"SSRSRS", | ||
| /*tile_binds=*/NullOpt, | ||
| /*max_innermost_factor=*/Integer(32), | ||
| /*vector_load_lens=*/NullOpt, | ||
| /*reuse_read=*/NullOpt, | ||
| /*reuse_write=*/ | ||
| Map<String, ObjectRef>{{"req", String("may")}, | ||
| {"levels", Array<Integer>{1, 2}}, | ||
| {"scope", String("global")}}), | ||
| }; | ||
| } | ||
|
|
||
| Array<ScheduleRule> ScheduleRule::DefaultARM(const String& type) { | ||
| return Array<ScheduleRule>::Agregate( | ||
| ScheduleRule::ApplyCustomRule(), ScheduleRule::InlineConstantScalars(), | ||
| ScheduleRule::AutoInline( | ||
| /*into_producer=*/false, | ||
| /*into_consumer=*/true, | ||
| /*inline_const_tensor=*/true, | ||
| /*disallow_if_then_else=*/true, | ||
| /*require_injective=*/true, | ||
| /*require_ordered=*/true, | ||
| /*disallow_op=*/Array<String>{"tir.exp"}), | ||
| ScheduleRule::AddRFactor( | ||
| /*max_jobs_per_core=*/8, | ||
| /*max_innermost_factor=*/Integer(32)), | ||
| "neon" == type ? GetNeonSpecificRules() : Array<ScheduleRule>{}, | ||
| "dotprod" == type ? GetDotprodSpecificRules() : Array<ScheduleRule>{}, | ||
| ScheduleRule::MultiLevelTiling( | ||
| /*structure=*/"SSRSRS", | ||
| /*tile_binds=*/NullOpt, | ||
| /*max_innermost_factor=*/Integer(32), | ||
| /*vector_load_lens=*/NullOpt, | ||
| /*reuse_read=*/NullOpt, | ||
| /*reuse_write=*/ | ||
| Map<String, ObjectRef>{{"req", String("may")}, | ||
| {"levels", Array<Integer>{1, 2}}, | ||
| {"scope", String("global")}}), | ||
| ScheduleRule::ParallelizeVectorizeUnroll( | ||
| /*max_jobs_per_core=*/8, | ||
| /*max_vectorize_extent=*/32, | ||
| /*unroll_max_steps=*/Array<Integer>{0, 8, 32, 256}, | ||
| /*unroll_explicit=*/true), | ||
| ScheduleRule::RandomComputeLocation()); | ||
| } | ||
|
|
||
| TVM_STATIC_IR_FUNCTOR(ReprPrinter, vtable) | ||
| .set_dispatch<PyScheduleRuleNode>([](const ObjectRef& n, ReprPrinter* p) { | ||
| const auto* self = n.as<PyScheduleRuleNode>(); | ||
|
|
@@ -325,6 +413,8 @@ TVM_REGISTER_GLOBAL("meta_schedule.ScheduleRuleDefaultHexagon") | |
| .set_body_typed(ScheduleRule::DefaultHexagon); | ||
| TVM_REGISTER_GLOBAL("meta_schedule.ScheduleRuleDefaultMicro") | ||
| .set_body_typed(ScheduleRule::DefaultMicro); | ||
| TVM_REGISTER_GLOBAL("meta_schedule.ScheduleRuleDefaultARM") | ||
| .set_body_typed(ScheduleRule::DefaultARM); | ||
|
|
||
| } // namespace meta_schedule | ||
| } // namespace tvm | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This edit (NOLINT) was made on the consideration that quote "Google C++ Style Guide seems to have allowed using non-const references as parameters".
Reference: https://github.innominds.com/cpplint/cpplint/issues/148