Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lang] Migrate irpass::scalarize() after irpass::lower_access() #8091

Merged
merged 9 commits into from
May 30, 2023
17 changes: 9 additions & 8 deletions taichi/transforms/compile_to_offloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,6 @@ void offload_to_executable(IRNode *ir,
print("Make block local");
}

if (config.real_matrix_scalarize) {
if (irpass::scalarize(ir)) {
// Remove redundant MatrixInitStmt inserted during scalarization
irpass::full_simplify(ir, config, {false, /*autodiff_enabled*/ false});
print("Scalarized");
}
}

if (is_extension_supported(config.arch, Extension::mesh)) {
irpass::demote_mesh_statements(ir, config, {kernel->get_name()});
print("Demote mesh statements");
Expand Down Expand Up @@ -276,6 +268,15 @@ void offload_to_executable(IRNode *ir,
irpass::analysis::verify(ir);
}

if (config.real_matrix_scalarize) {
if (irpass::scalarize(ir)) {
// Remove redundant MatrixInitStmt inserted during scalarization
irpass::full_simplify(ir, config,
{lower_global_access, /*autodiff_enabled*/ false});
print("Scalarized");
}
}

irpass::demote_operations(ir, config);
print("Operations demoted");

Expand Down