Skip to content

Commit

Permalink
prepare sora
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Jan 13, 2025
1 parent f9117f6 commit ef2ef05
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/luisa/luisa-compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
#include <luisa/xir/passes/outline.h>
#include <luisa/xir/passes/pointer_usage.h>
#include <luisa/xir/passes/sink_alloca.h>
#include <luisa/xir/passes/sroa.h>
#include <luisa/xir/passes/trace_gep.h>
#include <luisa/xir/pool.h>
#include <luisa/xir/special_register.h>
Expand Down
6 changes: 6 additions & 0 deletions include/luisa/xir/passes/sroa.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

namespace luisa::compute::xir {


}
15 changes: 11 additions & 4 deletions src/backends/fallback/fallback_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <luisa/xir/passes/dce.h>
#include <luisa/xir/passes/local_store_forward.h>
#include <luisa/xir/passes/local_load_elimination.h>
#include <luisa/xir/passes/trace_gep.h>

#include "../common/shader_print_formatter.h"

Expand Down Expand Up @@ -175,16 +176,22 @@ FallbackShader::FallbackShader(FallbackDevice *device, const ShaderOption &optio
// run some simple optimization passes on XIR to reduce the size of LLVM IR
Clock opt_clk;
auto dce1_info = xir::dce_pass_run_on_module(xir_module);
auto gep_trace_info = xir::trace_gep_pass_run_on_module(xir_module);
auto store_forward_info = xir::local_store_forward_pass_run_on_module(xir_module);
auto load_elim_info = xir::local_load_elimination_pass_run_on_module(xir_module);
auto dce2_info = xir::dce_pass_run_on_module(xir_module);
LUISA_INFO("Forwarded {} store instruction(s), "
LUISA_INFO("XIR optimization done in {} ms: "
"traced {} GEP instruction(s), "
"forwarded {} store instruction(s), "
"eliminated {} load instruction(s), "
"removed {} dead instruction(s) in {} ms.",
"removed {} + {} = {} dead instruction(s).",
opt_clk.toc(),
gep_trace_info.traced_geps.size(),
store_forward_info.forwarded_instructions.size(),
load_elim_info.eliminated_instructions.size(),
dce1_info.removed_instructions.size() + dce2_info.removed_instructions.size(),
opt_clk.toc());
dce1_info.removed_instructions.size(),
dce2_info.removed_instructions.size(),
dce1_info.removed_instructions.size() + dce2_info.removed_instructions.size());

// dump for debugging
if (LUISA_SHOULD_DUMP_XIR) {
Expand Down
1 change: 1 addition & 0 deletions src/xir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ set(LUISA_COMPUTE_XIR_SOURCES
passes/dom_tree.cpp
passes/outline.cpp
passes/sink_alloca.cpp
passes/sroa.cpp
passes/trace_gep.cpp
passes/aggregate_field_bitmask.cpp
passes/pointer_usage.cpp
Expand Down
7 changes: 7 additions & 0 deletions src/xir/passes/sroa.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <luisa/xir/passes/sroa.h>

namespace luisa::compute::xir {



}

0 comments on commit ef2ef05

Please sign in to comment.