Skip to content

Conversation

@VidithM
Copy link
Contributor

@VidithM VidithM commented Mar 7, 2025

  • Defer memcpys from the input to output matrix in row/colscale, select_bitmap until we know whether we are using CUDA. If so, do the memcpy inside the kernel.

@DrTimothyAldenDavis
Copy link
Owner

Oops... my last comment (just deleted) was a reference to LAGraph, not GraphBLAS ... I got mixed up on which package I was looking at.

int64_t *tmp_Ah = A->h ;
A->p = NULL ;
A->h = NULL ;
GB_OK (GB_dup_worker (&C, C_iso, A, false, ztype)) ;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't considered this option for using GB_dup_worker but I see from my code that it can work. However, it might be cleaner to revise GB_dup_worker, and pass in flags that disable the copy of specific parts of the matrix, like "bool Ap_dup" or something, for each component. I can pull in this PR for now, but a "// FIXME: revise this to use flags for each component" can be added here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. It looks like this wouldn't be a huge change, I can make a follow-up PR for this.

@DrTimothyAldenDavis
Copy link
Owner

Looks great overall, just some minor comments and tweaks above.

@DrTimothyAldenDavis
Copy link
Owner

GB_cuda_ek_slice needs some work. It assumes the input matrix is always the "A" matrix, and it has a specific type for the Ap array it's using: GB_Ap_TYPE. It's not GB_Aj_TYPE so that will break if Ap and Aj have different types. That's one reason why I'm still using plain int64_t for scalars, like the return value of GB_cuda_ek_slice_entry. We probably should use C++ templates here so I can call GB_cuda_ek_slice for other matrices, like "B".

@DrTimothyAldenDavis
Copy link
Owner

I see CUDA/template/GB_cuda_jit_AxB_dot3_dense_phase1.cuh is broken. I'm calling the ek_slice methods on the M matrix but internally I use the "A" matrix integers.

@VidithM
Copy link
Contributor Author

VidithM commented Mar 7, 2025

This should be good now. I'll make a follow-up PR to add flags to GB_dup_worker specifying which arrays to dup.


if (A->p != NULL)
{
GB_memcpy (C->p, A->p, (anvec+1) * psize, nthreads_max) ;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to assert that C->p and A->p have the same integer type. Likewise C->h and A->h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed - this is already known to be true from the results of GB_dup_worker, and we use the same assumption elsewhere, e.g. in the kernels. Should the same assert be there too?

@VidithM VidithM reopened this Mar 10, 2025
@VidithM
Copy link
Contributor Author

VidithM commented Mar 10, 2025

Addressed feedback and synced with the latest dev2 changes

@VidithM VidithM reopened this May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants