def __call__( self, definition_ir: StencilDefinition) -> Dict[str, Dict[str, str]]: gtir = DefIRToGTIR.apply(definition_ir) gtir_without_unused_params = prune_unused_parameters(gtir) dtype_deduced = resolve_dtype(gtir_without_unused_params) upcasted = upcast(dtype_deduced) oir = gtir_to_oir.GTIRToOIR().visit(upcasted) oir = self._optimize_oir(oir) sdfg = OirSDFGBuilder().visit(oir) sdfg.expand_library_nodes(recursive=True) # TODO uncomment once the branch dace/linus-fixes-8 is merged into dace/master # sdfg.apply_strict_transformations(validate=True) # noqa: E800 Found commented out code implementation = DaCeComputationCodegen.apply(gtir, sdfg) bindings = DaCeBindingsCodegen.apply(gtir, sdfg, module_name=self.module_name) bindings_ext = ".cu" if self.backend.GT_BACKEND_T == "gpu" else ".cpp" return { "computation": { "computation.hpp": implementation }, "bindings": { "bindings" + bindings_ext: bindings }, }
def resolve_dtype_and_validate(testee: Stencil, expected_dtypes: Dict[str, common.DataType]): # ensure consistency (input is not already fully resolved) for name, _dtype in expected_dtypes.items(): nodes = get_nodes_with_name(testee, name) assert len(nodes) > 0 assert any([node.dtype is None for node in nodes]) result: Stencil = resolve_dtype(testee) for name, dtype in expected_dtypes.items(): nodes = get_nodes_with_name(result, name) assert len(nodes) > 0 assert all([node.dtype == dtype for node in nodes])
def __call__(self, definition_ir) -> Dict[str, Dict[str, str]]: gtir = DefIRToGTIR.apply(definition_ir) gtir_without_unused_params = prune_unused_parameters(gtir) dtype_deduced = resolve_dtype(gtir_without_unused_params) upcasted = upcast(dtype_deduced) oir = gtir_to_oir.GTIRToOIR().visit(upcasted) oir = self._optimize_oir(oir) cuir = oir_to_cuir.OIRToCUIR().visit(oir) cuir = kernel_fusion.FuseKernels().visit(cuir) cuir = extent_analysis.ComputeExtents().visit(cuir) cuir = extent_analysis.CacheExtents().visit(cuir) implementation = cuir_codegen.CUIRCodegen.apply(cuir) bindings = GTCCudaBindingsCodegen.apply(cuir, module_name=self.module_name) return { "computation": {"computation.hpp": implementation}, "bindings": {"bindings.cu": bindings}, }
def __call__(self, definition_ir) -> Dict[str, Dict[str, str]]: gtir = DefIRToGTIR.apply(definition_ir) gtir_without_unused_params = prune_unused_parameters(gtir) dtype_deduced = resolve_dtype(gtir_without_unused_params) upcasted = upcast(dtype_deduced) oir = gtir_to_oir.GTIRToOIR().visit(upcasted) oir = self._optimize_oir(oir) gtcpp = oir_to_gtcpp.OIRToGTCpp().visit(oir) implementation = gtcpp_codegen.GTCppCodegen.apply( gtcpp, gt_backend_t=self.gt_backend_t) bindings = GTCppBindingsCodegen.apply(gtcpp, module_name=self.module_name, gt_backend_t=self.gt_backend_t) bindings_ext = ".cu" if self.gt_backend_t == "gpu" else ".cpp" return { "computation": { "computation.hpp": implementation }, "bindings": { "bindings" + bindings_ext: bindings }, }