Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
chlict committed Apr 6, 2020
1 parent fe90f17 commit dd66147
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/includes/ExprCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct ExprCompiler {
static constexpr auto compile(AST &&ast) {
auto ir1 = GenIR().transform(ast);
auto ir2 = AllocTensor().transform(ir1);
auto codes = CodeGenPass().transform(ir2);
auto codes = CodeGen().transform(ir2);
return codes;
}
};
2 changes: 1 addition & 1 deletion src/includes/xforms/CodeGen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct CodeGenXform {
}
};

struct CodeGenPass : StaticTransform {
struct CodeGen : StaticTransform {
using tag = xform_pass_tag;

// Given an IRList, returns the codes generated
Expand Down
13 changes: 2 additions & 11 deletions test/TestCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "xforms/GenIR.hpp"
#include "xforms/AllocTensor.hpp"
#include "xforms/CodeGen.hpp"
#include "ExprCompiler.hpp"

struct TestCodeGen : public ::testing::Test {
private:
Expand Down Expand Up @@ -76,17 +77,7 @@ TEST_F(TestCodeGen, StaticShape1) {
auto term2 = yap::make_terminal(tensor2);
auto term3 = yap::make_terminal(tensor3);
auto expr1 = (term1 + term2) * term3;
auto gen = yap::transform(expr1, GenIRXform{hana::make_tuple(), hana::make_tuple()});
// printf("After GenIR:\n");
// print_ir_list_simple(gen.mIRList);

auto at = AllocTensor();
auto ir2 = at.transform(gen.mIRList);
// printf("AllocTensor\n");
// print_ir_list_simple(ir2);

auto codes = hana::transform(ir2, [](auto &&ir) {
return yap::transform(ir, CodeGenXform());
});
auto codes = ExprCompiler::compile(expr1);
launch(codes);
}

0 comments on commit dd66147

Please sign in to comment.