Skip to content

Commit

Permalink
Fix AutoTVM flow
Browse files Browse the repository at this point in the history
  • Loading branch information
elvin-n committed Aug 31, 2022
1 parent 44ebc5e commit 02381d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
19 changes: 12 additions & 7 deletions python/tvm/topi/adreno/conv2d_nchw.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,17 @@ def schedule_conv2d_NCHWc_KCRSk(cfg, s, output):
# 3. If we have pad (independently if we have runtime repack or not) we should inline it in the
# cache_read("texture")
if autotvm.GLOBAL_SCOPE.in_tuning or input_pack_rt:
if "pad_temp" in pad_data.op.name:
pack_data = pad_data.op.input_tensors[0]
bind_data_copy(s[pack_data])
s[pad_data].compute_inline()
if autotvm.GLOBAL_SCOPE.in_tuning:
if "pad_temp" in pad_data.op.name:
s[pad_data].compute_inline()
else:
pack_data = pad_data
bind_data_copy(s[pack_data])
if "pad_temp" in pad_data.op.name:
pack_data = pad_data.op.input_tensors[0]
bind_data_copy(s[pack_data])
s[pad_data].compute_inline()
else:
pack_data = pad_data
bind_data_copy(s[pack_data])

AT = s.cache_read(pad_data, get_texture_storage(pad_data.shape), [conv])
bind_data_copy(s[AT])
Expand All @@ -291,7 +295,8 @@ def schedule_conv2d_NCHWc_KCRSk(cfg, s, output):
bind_data_copy(s[AT])

if autotvm.GLOBAL_SCOPE.in_tuning or filter_pack_rt:
bind_data_copy(s[kernel])
if not autotvm.GLOBAL_SCOPE.in_tuning:
bind_data_copy(s[kernel])
WT = s.cache_read(kernel, get_texture_storage(kernel.shape), [conv])
bind_data_copy(s[WT])

Expand Down
19 changes: 12 additions & 7 deletions python/tvm/topi/adreno/conv2d_nhwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,17 @@ def schedule_conv2d_NHWC(cfg, s, output):
# 3. If we have pad (independently if we have runtime repack or not) we should inline it in the
# cache_read("texture")
if autotvm.GLOBAL_SCOPE.in_tuning or input_pack_rt:
if "pad_temp" in pad_data.op.name:
s[pad_data].compute_inline()
pack_data = pad_data.op.input_tensors[0]
bind_data_copy(s[pack_data])
if autotvm.GLOBAL_SCOPE.in_tuning:
if "pad_temp" in pad_data.op.name:
s[pad_data].compute_inline()
else:
pack_data = pad_data
bind_data_copy(s[pack_data])
if "pad_temp" in pad_data.op.name:
s[pad_data].compute_inline()
pack_data = pad_data.op.input_tensors[0]
bind_data_copy(s[pack_data])
else:
pack_data = pad_data
bind_data_copy(s[pack_data])

AT = s.cache_read(pad_data, get_texture_storage(pad_data.shape), [conv])
bind_data_copy(s[AT])
Expand All @@ -289,7 +293,8 @@ def schedule_conv2d_NHWC(cfg, s, output):
bind_data_copy(s[AT])

if autotvm.GLOBAL_SCOPE.in_tuning or filter_pack_rt:
bind_data_copy(s[kernel])
if not autotvm.GLOBAL_SCOPE.in_tuning:
bind_data_copy(s[kernel])
WT = s.cache_read(kernel, get_texture_storage(kernel.shape), [conv])
bind_data_copy(s[WT])

Expand Down

0 comments on commit 02381d0

Please sign in to comment.