-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune #5684
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
1499d0a
bf727f9
f2e7fd3
cc8c7bc
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 |
|---|---|---|
|
|
@@ -142,11 +142,7 @@ def _schedule_spatial_pack(cfg, s, output, conv, data_vec, kernel_vec): | |
| s[data_vec].unroll(vw) | ||
|
|
||
| if isinstance(kernel_vec.op, tvm.te.ComputeOp) and kernel_vec.name == 'kernel_vec': | ||
| if autotvm.GLOBAL_SCOPE.in_tuning: | ||
| # kernel packing will be pre-computed during compilation, so we skip | ||
| # this part to make tuning records correct | ||
| s[kernel_vec].pragma(s[kernel_vec].op.axis[0], 'debug_skip_region') | ||
| else: | ||
| if not autotvm.GLOBAL_SCOPE.in_tuning: | ||
| max_threads = tvm.target.Target.current(allow_none=False).max_num_threads | ||
| co, ci, kh, kw, vc = s[kernel_vec].op.axis | ||
| fused = s[kernel_vec].fuse(co, ci, kh, kw, vc) | ||
|
|
@@ -313,10 +309,15 @@ def upround(x, align): | |
| data_pad[n][c][h][w], | ||
| name='d') | ||
|
|
||
| if pre_computed: | ||
| U = kernel | ||
| if autotvm.GLOBAL_SCOPE.in_tuning: | ||
| VC = cfg['tile_k'].size[-1] | ||
| kvshape = (KH + tile_size - 1, KW + tile_size - 1, tvm.tir.indexdiv(CO, VC), CI, VC) | ||
| U = tvm.te.placeholder(kvshape, kernel.dtype, name="U") | ||
| else: | ||
| U = _decl_winograd_kernel_transform(kernel, tile_size, G) | ||
| if pre_computed: | ||
| U = kernel | ||
| else: | ||
| U = _decl_winograd_kernel_transform(kernel, tile_size, G) | ||
|
|
||
| # V [alpha * alpha, C, P_round) | ||
| # Perform the image transform | ||
|
|
@@ -370,12 +371,7 @@ def _schedule_winograd(cfg, s, op): | |
| s[G].compute_inline() | ||
| eps, _, _, _ = s[U].op.axis | ||
| y, _, _, _ = s[padded_kernel].op.axis | ||
| if autotvm.GLOBAL_SCOPE.in_tuning: | ||
| # Kernel transformation will be pre-computed during compilation, so we skip | ||
| # this part to make tuning records correct | ||
| s[U].pragma(eps, 'debug_skip_region') | ||
| s[padded_kernel].pragma(y, 'debug_skip_region') | ||
| else: | ||
| if not autotvm.GLOBAL_SCOPE.in_tuning: | ||
|
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. Also winograd kernel transformation is different from spatial_pack. We need to have a different path inside winograd compute to generate placeholder.
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. I put the placeholder in |
||
| # Pad kernel | ||
| y, x, ky, kx = s[padded_kernel].op.axis | ||
| s[padded_kernel].unroll(ky) | ||
|
|
||
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.
Change schedule for arm_cpu conv2d as well?