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

[Schedule] support reorder #21

Merged
merged 4 commits into from
Jul 18, 2018
Merged

[Schedule] support reorder #21

merged 4 commits into from
Jul 18, 2018

Conversation

Huyuwei
Copy link
Collaborator

@Huyuwei Huyuwei commented Jul 17, 2018

This PR adds reorder schedule. Now we can write code:

  a = hcl.placeholder((10, 20, 30, 40))
  b = hcl.placeholder((10, 20, 30, 40))
  c = hcl.compute(a.shape, lambda i, j, k, l: a[i, j, k, l] + b[i, j, k, l])
  s = hcl.create_schedule(c)
  s[c].reorder(c.axis[2], c.axis[1])
  ir = hcl.lower(s, [a, b, c])

The generated IR is:

// attr [0] extern_scope = 0
for (i, 0, 10) {
  for (k, 0, 30) {
    for (j, 0, 20) {
      for (l, 0, 40) {
        compute8[(((l + (k*40)) + (j*1200)) + (i*24000))] = int32((int34(placeholder6[(((l + (k*40)) + (j*1200)) + (i*24000))]) + int34(placeholder7[(((l + (k*40)) + (j*1200)) + (i*24000))])))
      }
    }
  }
}

@comaniac
Copy link
Contributor

Could you modify the samples to demonstrate the usability in practice, and add unit tests?

@rzhao01
Copy link

rzhao01 commented Jul 18, 2018 via email

@zhangzhiru
Copy link

I agree with @comaniac . It's very important for us to create unit tests for each new feature we add as well as each bug fix.

@seanlatias seanlatias merged commit c89a732 into cornell-zhang:master Jul 18, 2018
@seanlatias
Copy link
Collaborator

We do have a unit test for this.

https://github.com/cornell-zhang/heterocl/blob/master/heterocl/tests/test_schedule.py

Nonetheless, we will make it more complete in the future.

@seanlatias
Copy link
Collaborator

It is similar to transpose. It's a good idea to directly take in a list of integers.

This pull request was closed.
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.

5 participants