2020-11-18 20:17:04 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
2020-02-21 21:06:13 +00:00
|
|
|
#include <stdexcept>
|
2020-03-16 18:38:29 +00:00
|
|
|
#include "test/cpp/tensorexpr/test_base.h"
|
2020-02-21 21:06:13 +00:00
|
|
|
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
#include <torch/csrc/jit/tensorexpr/expr.h>
|
|
|
|
|
#include <torch/csrc/jit/tensorexpr/ir.h>
|
|
|
|
|
#include <torch/csrc/jit/tensorexpr/ir_printer.h>
|
|
|
|
|
#include <torch/csrc/jit/tensorexpr/loopnest.h>
|
|
|
|
|
#include <torch/csrc/jit/tensorexpr/tensor.h>
|
|
|
|
|
#include <torch/csrc/jit/testing/file_check.h>
|
2020-02-21 21:06:13 +00:00
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
namespace torch {
|
|
|
|
|
namespace jit {
|
|
|
|
|
|
|
|
|
|
using namespace torch::jit::tensorexpr;
|
|
|
|
|
|
2020-11-18 20:17:04 +00:00
|
|
|
TEST(IRPrinter, BasicValueTest) {
|
2020-03-16 18:38:29 +00:00
|
|
|
ExprHandle a = IntImm::make(2), b = IntImm::make(3);
|
|
|
|
|
ExprHandle c = Add::make(a, b);
|
2020-02-21 21:06:13 +00:00
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << c;
|
2020-03-27 19:03:42 +00:00
|
|
|
ASSERT_EQ(ss.str(), "2 + 3");
|
2020-02-21 21:06:13 +00:00
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:17:04 +00:00
|
|
|
TEST(IRPrinter, BasicValueTest02) {
|
2020-03-16 18:38:29 +00:00
|
|
|
ExprHandle a(2.0f);
|
|
|
|
|
ExprHandle b(3.0f);
|
|
|
|
|
ExprHandle c(4.0f);
|
|
|
|
|
ExprHandle d(5.0f);
|
|
|
|
|
ExprHandle f = (a + b) - (c + d);
|
2020-02-21 21:06:13 +00:00
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << f;
|
2020-03-27 19:03:42 +00:00
|
|
|
ASSERT_EQ(ss.str(), "(2.f + 3.f) - (4.f + 5.f)");
|
2020-02-21 21:06:13 +00:00
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:17:04 +00:00
|
|
|
TEST(IRPrinter, CastTest) {
|
2020-05-09 23:21:46 +00:00
|
|
|
VarHandle x("x", kHalf);
|
2020-03-16 18:38:29 +00:00
|
|
|
VarHandle y("y", kFloat);
|
2020-05-09 23:21:46 +00:00
|
|
|
ExprHandle body = ExprHandle(2.f) +
|
|
|
|
|
(Cast::make(kFloat, x) * ExprHandle(3.f) + ExprHandle(4.f) * y);
|
2020-02-21 21:06:13 +00:00
|
|
|
|
|
|
|
|
std::stringstream ss;
|
2020-05-09 23:21:46 +00:00
|
|
|
ss << body;
|
|
|
|
|
ASSERT_EQ(ss.str(), "2.f + (float(x) * 3.f + 4.f * y)");
|
2020-02-21 21:06:13 +00:00
|
|
|
}
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
|
2020-11-18 20:17:04 +00:00
|
|
|
TEST(IRPrinter, FunctionName) {
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
int M = 4;
|
|
|
|
|
int N = 20;
|
|
|
|
|
|
2021-08-24 07:29:22 +00:00
|
|
|
Tensor producer = Compute(
|
2022-02-11 01:17:09 +00:00
|
|
|
"producer", {M, N}, [&](const ExprHandle& m, const ExprHandle& n) {
|
|
|
|
|
return m * n;
|
|
|
|
|
});
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
|
2021-08-24 07:29:22 +00:00
|
|
|
Tensor chunk_0 = Compute(
|
2022-02-11 01:17:09 +00:00
|
|
|
"chunk_0", {M, N / 2}, [&](const ExprHandle& m, const ExprHandle& n) {
|
2021-08-24 07:29:22 +00:00
|
|
|
return producer.load(m, n);
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
});
|
|
|
|
|
|
2021-08-24 07:29:22 +00:00
|
|
|
Tensor chunk_1 = Compute(
|
2022-02-11 01:17:09 +00:00
|
|
|
"chunk_1", {M, N / 2}, [&](const ExprHandle& m, const ExprHandle& n) {
|
2021-08-24 07:29:22 +00:00
|
|
|
return producer.load(m, n + ExprHandle(N / 2));
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
});
|
|
|
|
|
|
2021-08-24 07:29:22 +00:00
|
|
|
Tensor consumer = Compute(
|
2022-02-11 01:17:09 +00:00
|
|
|
"consumer", {M, N / 2}, [&](const ExprHandle& i, const ExprHandle& j) {
|
2021-08-24 07:29:22 +00:00
|
|
|
return i * chunk_1.load(i, j);
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
LoopNest l({chunk_0, chunk_1, consumer});
|
2022-02-11 01:17:09 +00:00
|
|
|
auto body = LoopNest::sanitizeNames(l.root_stmt());
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << *body;
|
|
|
|
|
|
|
|
|
|
const std::string& verification_pattern =
|
|
|
|
|
R"IR(
|
2022-02-11 01:17:09 +00:00
|
|
|
# CHECK: for (int i_2
|
|
|
|
|
# CHECK: for (int j_2
|
|
|
|
|
# CHECK: consumer[i_2, j_2] = i_2 * (chunk_1[i_2, j_2])IR";
|
[TensorExpr] Fix IRPrinter for function calls with uniqued names (#39753)
Summary:
IRPrinter was using the name_hint rather than the uniqued name when printing FunctionCalls, leading to output that appeared incorrect.
E.g. for the following set of tensorexprs:
```
producer[M, N] = M * N;
chunk[M, N/2] = producer[M, N];
chunk_1[M, N/2] = producer[M, N + N/2];
consumer[M, N] = chunk_1[M, N];
```
Before fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk(i, j)); <----- HERE!
}
}
}
```
After fix:
```
{
for (int m = 0; m < 4; m++) {
for (int n = 0; n < 20; n++) {
producer[m, n] = m * n;
}
}
for (int m_1 = 0; m_1 < 4; m_1++) {
for (int n_1 = 0; n_1 < 10; n_1++) {
chunk[m_1, n_1] = producer(m_1, n_1);
}
}
for (int m_2 = 0; m_2 < 4; m_2++) {
for (int n_2 = 0; n_2 < 10; n_2++) {
chunk_1[m_2, n_2] = producer(m_2, n_2 + 10);
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 10; j++) {
consumer[i, j] = i * (chunk_1(i, j)); <----- HERE!
}
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39753
Differential Revision: D21962441
Pulled By: nickgg
fbshipit-source-id: caa429caf0df9c7b16e109937412587bff6dc886
2020-06-11 19:04:50 +00:00
|
|
|
|
|
|
|
|
torch::jit::testing::FileCheck().run(verification_pattern, ss.str());
|
|
|
|
|
}
|
2020-02-21 21:06:13 +00:00
|
|
|
} // namespace jit
|
|
|
|
|
} // namespace torch
|