Skip to content
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

[SME][TOPI] Add conv2d NHWC SME fp32 schedule #17003

Merged
merged 4 commits into from
May 28, 2024

Conversation

Anndrey24
Copy link
Contributor

This commit adds a scalable arm_cpu conv2d NHWC schedule for fp32 which generates SME instructions by using the tensor intrinsics introduced in #16921.

Alongside the SME schedule, the logic of the TE schedule schedule_conv2d_gemm_native() for both non-scalable and scalable vector implementations has also been translated into the new TIR schedule. This means that the TE compute definition compute_conv2d_NHWC_hybrid() is now compatible with both the original TE schedules (e.g. schedule_conv2d_NHWC_hybrid()) and the newly introduced TIR schedule schedule_conv2d_NHWC_hybrid_TIR(). The corresponding TOPI test has been extended to reflect that.

cc @ekalda @lhutton1

@Anndrey24
Copy link
Contributor Author

@tvm-bot rerun

Copy link
Contributor

Failed to re-run CI in https://github.com/apache/tvm/actions/runs/9147913719

Traceback (most recent call last):
  File "ci/scripts/github/github_tvmbot.py", line 595, in comment_failure
    raise item
  File "ci/scripts/github/github_tvmbot.py", line 701, in run
    pr.rerun_jenkins_ci()
  File "ci/scripts/github/github_tvmbot.py", line 554, in rerun_jenkins_ci
    post(url, auth=("tvm-bot", TVM_BOT_JENKINS_TOKEN))
  File "/home/runner/work/tvm/tvm/ci/scripts/jenkins/git_utils.py", line 53, in post
    with request.urlopen(req, data) as response:
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 502: Bad Gateway

with response

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Anndrey24 great work - it's awesome to see this coming together! I left a few comments, largely nitpicks and a couple of questions

tests/python/codegen/test_target_codegen_aarch64.py Outdated Show resolved Hide resolved
tests/python/topi/test_topi_conv2d_nhwc.py Outdated Show resolved Hide resolved
tests/python/topi/test_topi_conv2d_nhwc.py Outdated Show resolved Hide resolved
tests/python/topi/test_topi_conv2d_nhwc.py Outdated Show resolved Hide resolved
tests/python/relay/strategy/arm_cpu/test_conv2d.py Outdated Show resolved Hide resolved
tests/python/relay/strategy/arm_cpu/test_conv2d.py Outdated Show resolved Hide resolved
python/tvm/topi/arm_cpu/conv2d.py Show resolved Hide resolved
python/tvm/topi/arm_cpu/conv2d.py Show resolved Hide resolved
This commit adds a scalable `arm_cpu` conv2d NHWC schedule for fp32 which generates SME instructions by using the tensor intrinsics introduced in apache#16921.

Alongside the SME schedule, the logic of the TE schedule `schedule_conv2d_gemm_native()` for both non-scalable and scalable vector implementations has also been translated into the new TIR schedule. This means that the TE compute definition `compute_conv2d_NHWC_hybrid()` is now compatible with both the original TE schedules (e.g. `schedule_conv2d_NHWC_hybrid()`) and the newly introduced TIR schedule `schedule_conv2d_NHWC_hybrid_TIR()`. The corresponding TOPI test has been extended to reflect that.
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! - It looks like there's a merge conflict that needs to be fixed :/

@Anndrey24
Copy link
Contributor Author

Resolved the conflict!

Copy link
Contributor

@ekalda ekalda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very cool!

@ekalda ekalda merged commit cab54e0 into apache:main May 28, 2024
19 checks passed
@ekalda
Copy link
Contributor

ekalda commented May 28, 2024

Thanks @Anndrey24 and @lhutton1, this is now merged!

@tqchen
Copy link
Member

tqchen commented May 28, 2024

Thanks @Anndrey24 @lhutton1 @ekalda .

Seems we have a breakage/flaky likely related to this pr https://ci.tlcpack.ai/blue/organizations/jenkins/tvm-arm/detail/main/1980/pipeline (in lint,arm, and cpu jobs).

tqchen added a commit that referenced this pull request May 28, 2024
@tqchen
Copy link
Member

tqchen commented May 29, 2024

I created a temp revert, #17038 to unblock the ci, if there is an alternative fix that would also be good, eitherway we followup with a redo quickly.

lhutton1 added a commit to lhutton1/tvm that referenced this pull request May 29, 2024
Fixes a merge conflict between apache#16981 and apache#17003.

Change-Id: Ifcc983ef0b8c00250568a048fd682933adfdcde4
tqchen pushed a commit that referenced this pull request May 29, 2024
Fixes a merge conflict between #16981 and #17003.

Change-Id: Ifcc983ef0b8c00250568a048fd682933adfdcde4
@Anndrey24 Anndrey24 deleted the sme-conv2d-fp32 branch May 29, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants