From 97d60c42baf9f4ba02cc95ecc3f5782030d65757 Mon Sep 17 00:00:00 2001 From: brandon-b-miller <53796099+brandon-b-miller@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:56:09 -0500 Subject: [PATCH] Remove unnecessary pointer copying in JIT GroupBy Apply (#13792) This PR removes some extra stores and loads that don't appear to be necessary in our groupby apply lowering which are possibly slowing things down. This came up during https://github.com/rapidsai/cudf/pull/13767. Authors: - https://github.com/brandon-b-miller Approvers: - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/cudf/pull/13792 --- python/cudf/cudf/core/udf/groupby_lowering.py | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/python/cudf/cudf/core/udf/groupby_lowering.py b/python/cudf/cudf/core/udf/groupby_lowering.py index 376eccb9308..f82b5aae26c 100644 --- a/python/cudf/cudf/core/udf/groupby_lowering.py +++ b/python/cudf/cudf/core/udf/groupby_lowering.py @@ -37,10 +37,6 @@ def group_reduction_impl_basic(context, builder, sig, args, function): grp_type = sig.args[0] group_dataty = grp_type.group_data_type - # logically take the address of the group's data pointer - group_data_ptr = builder.alloca(grp.group_data.type) - builder.store(grp.group_data, group_data_ptr) - # obtain the correct forward declaration from registry type_key = (sig.return_type, grp_type.group_scalar_type) func = call_cuda_functions[function][type_key] @@ -51,7 +47,7 @@ def group_reduction_impl_basic(context, builder, sig, args, function): builder, func, nb_signature(retty, group_dataty, grp_type.group_size_type), - (builder.load(group_data_ptr), grp.size), + (grp.group_data, grp.size), ) @@ -95,13 +91,6 @@ def group_reduction_impl_idx_max_or_min(context, builder, sig, args, function): "are supported." ) - group_dataty = grp_type.group_data_type - group_data_ptr = builder.alloca(grp.group_data.type) - builder.store(grp.group_data, group_data_ptr) - - index_dataty = grp_type.group_index_type - index_ptr = builder.alloca(grp.index.type) - builder.store(grp.index, index_ptr) type_key = (index_default_type, grp_type.group_scalar_type) func = call_cuda_functions[function][type_key] @@ -109,9 +98,12 @@ def group_reduction_impl_idx_max_or_min(context, builder, sig, args, function): builder, func, nb_signature( - retty, group_dataty, index_dataty, grp_type.group_size_type + retty, + grp_type.group_data_type, + grp_type.group_index_type, + grp_type.group_size_type, ), - (builder.load(group_data_ptr), builder.load(index_ptr), grp.size), + (grp.group_data, grp.index, grp.size), )