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

fix[cartesian]: DaceIR bridge for DaCe v0.15 #1373

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/gt4py/cartesian/backend/dace_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class DaCeComputationCodegen:
const int __I = domain[0];
const int __J = domain[1];
const int __K = domain[2];
${name}_t dace_handle;
${name}_${state_suffix} dace_handle;
${backend_specifics}
auto allocator = gt::sid::cached_allocator(&${allocator}<char[]>);
${"\\n".join(tmp_allocs)}
Expand Down Expand Up @@ -561,13 +561,21 @@ def apply(cls, stencil_ir: gtir.Stencil, builder: "StencilBuilder", sdfg: dace.S
else:
omp_threads = ""
omp_header = ""

# Backward compatible state struct name change in DaCe >=0.15.x
try:
FlorianDeconinck marked this conversation as resolved.
Show resolved Hide resolved
dace_state_suffix = dace.Config.get("compiler.codegen_state_struct_suffix")
except (KeyError, TypeError):
dace_state_suffix = "t" # old structure name

interface = cls.template.definition.render(
name=sdfg.name,
backend_specifics=omp_threads,
dace_args=self.generate_dace_args(stencil_ir, sdfg),
functor_args=self.generate_functor_args(sdfg),
tmp_allocs=self.generate_tmp_allocs(sdfg),
allocator="gt::cuda_util::cuda_malloc" if is_gpu else "std::make_unique",
state_suffix=dace_state_suffix,
)
generated_code = textwrap.dedent(
f"""#include <gridtools/sid/sid_shift_origin.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/gt4py/cartesian/gtc/daceir.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def from_dace_schedule(cls, schedule):
dace.ScheduleType.Default: MapSchedule.Default,
dace.ScheduleType.Sequential: MapSchedule.Sequential,
dace.ScheduleType.CPU_Multicore: MapSchedule.CPU_Multicore,
dace.ScheduleType.GPU_Default: MapSchedule.GPU_Device,
dace.ScheduleType.GPU_Device: MapSchedule.GPU_Device,
dace.ScheduleType.GPU_ThreadBlock: MapSchedule.GPU_ThreadBlock,
}[schedule]
Expand Down