|
20 | 20 |
|
21 | 21 | #include <ATen/ATen.h>
|
22 | 22 |
|
| 23 | +#include "tc/aten/utils.h" |
| 24 | +#include "tc/core/cpu/cpu_tc_executor.h" |
| 25 | +#include "tc/core/execution_engine.h" |
| 26 | +#include "tc/core/mapping_options.h" |
23 | 27 | #include "tc/core/polyhedral/codegen_llvm.h"
|
24 | 28 | #include "tc/core/polyhedral/llvm_jit.h"
|
25 | 29 | #include "tc/core/polyhedral/scop.h"
|
| 30 | +#include "tc/core/scope_guard.h" |
26 | 31 |
|
27 | 32 | #include "test_harness_aten.h"
|
28 | 33 |
|
@@ -61,6 +66,29 @@ def fun(float(N, M) A, float(N, M) B) -> (C) {
|
61 | 66 | checkRtol(Cc - C, {A, B}, N * M);
|
62 | 67 | }
|
63 | 68 |
|
| 69 | +TEST(LLVMCodegen, DISABLED_BasicExecutionEngine) { |
| 70 | + string tc = R"TC( |
| 71 | +def fun(float(N, M) A, float(N, M) B) -> (C) { |
| 72 | + C(i, j) = A(i, j) + B(i, j) |
| 73 | +} |
| 74 | +)TC"; |
| 75 | + |
| 76 | + auto N = 40; |
| 77 | + auto M = 24; |
| 78 | + |
| 79 | + at::Tensor A = at::CPU(at::kFloat).rand({N, M}); |
| 80 | + at::Tensor B = at::CPU(at::kFloat).rand({N, M}); |
| 81 | + at::Tensor C = at::CPU(at::kFloat).rand({N, M}); |
| 82 | + |
| 83 | + ExecutionEngine<CpuTcExecutor> engine; |
| 84 | + engine.define(tc); |
| 85 | + auto options = tc::MappingOptions::makeNaiveMappingOptions(); |
| 86 | + auto inputDLTensorsPair = toConstDlpackTensors({A, B}); |
| 87 | + ScopeGuard g([&]() { deleteDlmTensors(inputDLTensorsPair.second); }); |
| 88 | + engine.compile( |
| 89 | + "fun", inputDLTensorsPair.first, options.toProtobufSerializedString()); |
| 90 | +} |
| 91 | + |
64 | 92 | TEST(LLVMCodegen, MultiStmt) {
|
65 | 93 | string tc = R"TC(
|
66 | 94 | def fun(float(N, M, K, L) A, float(N, M) B, float(N, M) C, float(N, M) D)
|
|
0 commit comments