more progress

This commit is contained in:
Philippe Tillet
2019-09-08 21:29:40 -04:00
parent 32234c2612
commit 3d78810d5e
4 changed files with 12 additions and 3 deletions

View File

@@ -157,7 +157,7 @@ grids::fragment_t grids::get_fragmentation_type(node_t x, graph_t &graph){
} }
void grids::connected_components(node_t x, const std::vector<ir::metaparameter *> mps, const std::vector<std::string> prefixes, std::set<node_t> &nodes, graph_t &graph, unsigned group_id) { void grids::connected_components(node_t x, const std::vector<ir::metaparameter *> mps, const std::vector<std::string> prefixes, std::set<node_t> &nodes, graph_t &graph, unsigned group_id) {
// std::cout << "connected component: " << x.first->get_name() << " " << x.second << std::endl; std::cout << "connected component: " << x.first->get_name() << " " << x.second << std::endl;
groups_[x.first].insert({x.second, group_id}); groups_[x.first].insert({x.second, group_id});
if(nodes.find(x) != nodes.end()){ if(nodes.find(x) != nodes.end()){
nodes.erase(x); nodes.erase(x);
@@ -229,10 +229,13 @@ void grids::run(ir::module &mod) {
create_grids(grids_, references, fn); create_grids(grids_, references, fn);
} }
unsigned num_threads = get_num_threads(); unsigned num_threads = get_num_threads();
auto clamp = [&](unsigned x, unsigned lo, unsigned hi) { return std::min(std::max(x, lo), hi); }; auto clamp = [&](unsigned x, unsigned lo, unsigned hi) { return std::min(std::max(x, lo), hi); };
for(ir::value *i: grids_){ for(ir::value *i: grids_){
std::cout << "grid: " << i->get_name() << std::endl;
if(!i->get_type()->is_tile_ty()) if(!i->get_type()->is_tile_ty())
continue; continue;
auto shapes = i->get_type()->get_tile_shapes(); auto shapes = i->get_type()->get_tile_shapes();

View File

@@ -1436,6 +1436,7 @@ void selection::lower_tile_instruction(ir::instruction *ins, llvm::IRBuilder<> &
} }
void selection::lower_instruction(ir::instruction *src, IRBuilder<> &builder) { void selection::lower_instruction(ir::instruction *src, IRBuilder<> &builder) {
std::cout << src->get_name() << std::endl;
if(src->has_tile_result_or_op()) { if(src->has_tile_result_or_op()) {
lower_tile_instruction(src, builder); lower_tile_instruction(src, builder);
} }

View File

@@ -731,6 +731,7 @@ barrier_inst* barrier_inst::create(context &ctx, const std::string &name, instru
return new barrier_inst(ctx, name, next); return new barrier_inst(ctx, name, next);
} }
// nv_dynamic_program_idx // nv_dynamic_program_idx
nv_dynamic_program_idx_inst::nv_dynamic_program_idx_inst(type *ty, const std::string &name, instruction *next) nv_dynamic_program_idx_inst::nv_dynamic_program_idx_inst(type *ty, const std::string &name, instruction *next)
: instruction(ty, 0, 1, name, next) { } : instruction(ty, 0, 1, name, next) { }
@@ -754,5 +755,6 @@ nv_static_program_idx* nv_static_program_idx::get(constant_range* range) {
} }
} }
} }

View File

@@ -199,7 +199,7 @@ std::unique_ptr<driver::module> function::make_bin(ir::module &module, driver::c
codegen::analysis::liveness shmem_liveness(&shmem_info); codegen::analysis::liveness shmem_liveness(&shmem_info);
codegen::analysis::memalloc shmem_allocation(&shmem_liveness, &shmem_info, &grids); codegen::analysis::memalloc shmem_allocation(&shmem_liveness, &shmem_info, &grids);
codegen::analysis::align alignment_info; codegen::analysis::align alignment_info;
codegen::transform::reorder reorder(&alignment_info); codegen::transform::reorder reorder(&alignment_info, &shmem_info);
codegen::transform::membar shmem_barriers(&shmem_allocation, &shmem_info); codegen::transform::membar shmem_barriers(&shmem_allocation, &shmem_info);
codegen::transform::vectorize vectorize(&grids); codegen::transform::vectorize vectorize(&grids);
codegen::transform::dce dce; codegen::transform::dce dce;
@@ -211,7 +211,9 @@ std::unique_ptr<driver::module> function::make_bin(ir::module &module, driver::c
dce.run(module); dce.run(module);
alignment_info.run(module); alignment_info.run(module);
ir::print(module, std::cout); ir::print(module, std::cout);
// reorder.run(module); if(target->is_gpu())
shmem_info.run(module);
reorder.run(module);
dce.run(module); dce.run(module);
ir::print(module, std::cout); ir::print(module, std::cout);
grids.run(module); grids.run(module);
@@ -229,6 +231,7 @@ std::unique_ptr<driver::module> function::make_bin(ir::module &module, driver::c
dce.run(module); dce.run(module);
vectorize.run(module); vectorize.run(module);
dce.run(module); dce.run(module);
ir::print(module, std::cout);
// generate llvm code // generate llvm code
llvm::LLVMContext ctx; llvm::LLVMContext ctx;
std::unique_ptr<llvm::Module> llvm(new llvm::Module(module.get_name(), ctx)); std::unique_ptr<llvm::Module> llvm(new llvm::Module(module.get_name(), ctx));