Skip to content

Commit

Permalink
Remove unnecessary pointer copying in JIT GroupBy Apply (#13792)
Browse files Browse the repository at this point in the history
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 #13767.

Authors:
  - https://github.com/brandon-b-miller

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #13792
  • Loading branch information
brandon-b-miller authored Aug 1, 2023
1 parent 3254934 commit 97d60c4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions python/cudf/cudf/core/udf/groupby_lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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),
)


Expand Down Expand Up @@ -95,23 +91,19 @@ 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]

return context.compile_internal(
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),
)


Expand Down

0 comments on commit 97d60c4

Please sign in to comment.