Skip to content

Commit 0a3eca0

Browse files
committed
added --restructure-everything hack
1 parent 676cc1c commit 0a3eca0

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

include/shady/ir.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ struct CompilerConfig_ {
279279
bool spv_shuffle_instead_of_broadcast_first;
280280
bool force_join_point_lifting;
281281
bool assume_no_physical_global_ptrs;
282+
bool restructure_everything;
282283
} hacks;
283284

284285
struct {

samples/aobench/ao_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ int main(int argc, char **argv) {
147147
}
148148
};
149149

150+
args.compiler_config.hacks.restructure_everything = true;
151+
150152
cli_parse_common_args(&argc, argv);
151153
cli_parse_compiler_config_args(&args.compiler_config, &argc, argv);
152154
cli_parse_common_app_arguments(&args.common_app_args, &argc, argv);

src/driver/cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ F(logging.print_generated, print-builtin) \
9999
F(logging.print_generated, print-generated) \
100100
F(lower.simt_to_explicit_simd, lower-simt-to-simd) \
101101
F(optimisations.inline_everything, inline-everything) \
102+
F(hacks.restructure_everything, restructure-everything) \
102103

103104
void cli_parse_compiler_config_args(CompilerConfig* config, int* pargc, char** argv) {
104105
int argc = *pargc;

src/shady/passes/reconvergence_heuristics.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
typedef struct Context_ {
2020
Rewriter rewriter;
21+
const CompilerConfig* config;
2122
const Node* current_fn;
2223
const Node* current_abstraction;
2324
Scope* fwd_scope;
@@ -320,11 +321,11 @@ static const Node* process_node(Context* ctx, const Node* node) {
320321
}
321322
case Case_TAG:
322323
case BasicBlock_TAG:
323-
if (!ctx->current_fn || !lookup_annotation(ctx->current_fn, "Restructure"))
324+
if (!ctx->current_fn || !(lookup_annotation(ctx->current_fn, "Restructure") || ctx->config->hacks.restructure_everything))
324325
break;
325326
return process_abstraction(ctx, node);
326327
case Branch_TAG: {
327-
if (!ctx->current_fn || !lookup_annotation(ctx->current_fn, "Restructure"))
328+
if (!ctx->current_fn || !(lookup_annotation(ctx->current_fn, "Restructure") || ctx->config->hacks.restructure_everything))
328329
break;
329330
assert(ctx->fwd_scope);
330331

@@ -469,13 +470,14 @@ static const Node* process_node(Context* ctx, const Node* node) {
469470
return recreate_node_identity(rewriter, node);
470471
}
471472

472-
Module* reconvergence_heuristics(SHADY_UNUSED const CompilerConfig* config, Module* src) {
473+
Module* reconvergence_heuristics(const CompilerConfig* config, Module* src) {
473474
ArenaConfig aconfig = get_arena_config(get_module_arena(src));
474475
IrArena* a = new_ir_arena(aconfig);
475476
Module* dst = new_module(a, get_module_name(src));
476477

477478
Context ctx = {
478479
.rewriter = create_rewriter(src, dst, (RewriteNodeFn) process_node),
480+
.config = config,
479481
.current_fn = NULL,
480482
.fwd_scope = NULL,
481483
.back_scope = NULL,

0 commit comments

Comments
 (0)